Commit aea2f87bdd811f24eb83b87e5a8e229dc0662e7f
1 parent
efbdc718d0
Refactor bundle tests for readability.
Showing 1 changed file with 5 additions and 17 deletions Side-by-side Diff
tests/bundle-syntaxes.t
| 1 | -Helper aliases. | |
| 1 | +Test helper function. | |
| 2 | 2 | |
| 3 | - $ alias b=bundle | |
| 4 | - $ alias lb='bundle-list | tail -1' # lb = last bundle | |
| 3 | + $ b () { | |
| 4 | + > bundle "$@" | |
| 5 | + > bundle-list | tail -1 | |
| 6 | + > } | |
| 5 | 7 | |
| 6 | 8 | Short and sweet. |
| 7 | 9 | |
| 8 | 10 | $ b plugin-name |
| 9 | - $ lb | |
| 10 | 11 | plugin-name https://github.com/robbyrussell/oh-my-zsh.git plugins/plugin-name |
| 11 | 12 | |
| 12 | 13 | Short repo url. |
| 13 | 14 | |
| 14 | 15 | $ b github-username/repo-name |
| 15 | - $ lb | |
| 16 | 16 | repo-name https://github.com/github-username/repo-name.git / |
| 17 | 17 | |
| 18 | 18 | Short repo url with `.git` suffix. |
| 19 | 19 | |
| 20 | 20 | $ b github-username/repo-name.git |
| 21 | - $ lb | |
| 22 | 21 | repo-name https://github.com/github-username/repo-name.git / |
| 23 | 22 | |
| 24 | 23 | Long repo url. |
| 25 | 24 | |
| 26 | 25 | $ b https://github.com/user/repo.git |
| 27 | - $ lb | |
| 28 | 26 | repo https://github.com/user/repo.git / |
| 29 | 27 | |
| 30 | 28 | Long repo url with missing `.git` suffix (should'nt add the suffix). |
| 31 | 29 | |
| 32 | 30 | $ b https://github.com/user/repo |
| 33 | - $ lb | |
| 34 | 31 | repo https://github.com/user/repo / |
| 35 | 32 | |
| 36 | 33 | Short repo with location. |
| 37 | 34 | |
| 38 | 35 | $ b user/plugin path/to/plugin |
| 39 | - $ lb | |
| 40 | 36 | plugin https://github.com/user/plugin.git path/to/plugin |
| 41 | 37 | |
| 42 | 38 | Short repo with location and name. |
| 43 | 39 | |
| 44 | 40 | $ b user/repo plugin/path plugin-name |
| 45 | - $ lb | |
| 46 | 41 | plugin-name https://github.com/user/repo.git plugin/path |
| 47 | 42 | |
| 48 | 43 | Long repo with location and name. |
| 49 | 44 | |
| 50 | 45 | $ b https://github.com/user/repo.git plugin/path plugin-name |
| 51 | - $ lb | |
| 52 | 46 | plugin-name https://github.com/user/repo.git plugin/path |
| 53 | 47 | |
| 54 | 48 | Keyword arguments, in respective places. |
| 55 | 49 | |
| 56 | 50 | $ b --url=user/repo --loc=path/of/plugin --name=plugin-name |
| 57 | - $ lb | |
| 58 | 51 | plugin-name https://github.com/user/repo.git path/of/plugin |
| 59 | 52 | |
| 60 | 53 | Keyword arguments, in respective places, with full repo url. |
| 61 | 54 | |
| 62 | 55 | $ b --url=https://github.com/user/repo.git --loc=plugin/path --name=name |
| 63 | - $ lb | |
| 64 | 56 | name https://github.com/user/repo.git plugin/path |
| 65 | 57 | |
| 66 | 58 | Keyword arguments, in reversed order. |
| 67 | 59 | |
| 68 | 60 | $ b --name=plugin-name --loc=path/of/plugin --url=user/repo |
| 69 | - $ lb | |
| 70 | 61 | plugin-name https://github.com/user/repo.git path/of/plugin |
| 71 | 62 | |
| 72 | 63 | Mixed positional and keyword arguments, and skip `loc`. |
| 73 | 64 | |
| 74 | 65 | $ b user/repo --name=plugin |
| 75 | - $ lb | |
| 76 | 66 | plugin https://github.com/user/repo.git / |
| 77 | 67 | |
| 78 | 68 | Just `loc`, using keyword arguments. |
| 79 | 69 | |
| 80 | 70 | $ b --loc=plugin/path |
| 81 | - $ lb | |
| 82 | 71 | path https://github.com/robbyrussell/oh-my-zsh.git plugin/path |
| 83 | 72 | |
| 84 | 73 | Just `name`, using keyword arguments. |
| 85 | 74 | |
| 86 | 75 | $ b --name=robby-oh-my-zsh |
| 87 | - $ lb | |
| 88 | 76 | robby-oh-my-zsh https://github.com/robbyrussell/oh-my-zsh.git / |
| 89 | 77 | |
| 90 | 78 | TODO: Error reporting with erroneous arguments or usage with incorrect syntax. |