From fe44337cbba8ddfbe7d859c636dd70eb1865ea4e Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Date: Thu, 7 Jun 2012 15:52:11 +0530 Subject: [PATCH] Add test file for bundle command syntaxes. Tests are currently failing and already helped me spot a bug with the argument parsing (That's where the tests fail). --- tests/bundle-syntaxes.t | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tests/bundle-syntaxes.t diff --git a/tests/bundle-syntaxes.t b/tests/bundle-syntaxes.t new file mode 100644 index 0000000..df1357f --- /dev/null +++ b/tests/bundle-syntaxes.t @@ -0,0 +1,85 @@ +Helper aliases. + + $ alias b=bundle + $ alias lb='bundle-list | tail -1' # lb = last bundle + +Short and sweet. + + $ b plugin-name + $ lb + plugin-name https://github.com/robbyrussell/oh-my-zsh.git plugins/plugin-name + +Short repo url. + + $ b github-username/repo-name + $ lb + repo-name https://github.com/github-username/repo-name.git / + +Short repo url with `.git` suffix. + + $ b github-username/repo-name.git + $ lb + repo-name https://github.com/github-username/repo-name.git / + +Long repo url. + + $ b https://github.com/user/repo.git + $ lb + repo https://github.com/user/repo.git / + +Long repo url with missing `.git` suffix (should'nt add the suffix). + + $ b https://github.com/user/repo + $ lb + repo https://github.com/user/repo / + +Short repo with location. + + $ b user/plugin path/to/plugin + $ lb + plugin https://github.com/user/plugin.git path/to/plugin + +Short repo with location and name. + + $ b user/repo plugin/path plugin-name + $ lb + plugin-name https://github.com/user/repo.git plugin/path + +Long repo with location and name. + + $ b https://github.com/user/repo plugin/path plugin-name + $ lb + plugin-name https://github.com/user/repo.git plugin/path + +Keyword arguments, in respective places. + + $ b --url=user/repo --loc=path/of/plugin --name=plugin-name + $ lb + plugin-name https://github.com/user/repo.git path/of/plugin + +Keyword arguments, in respective places, with full repo url. + + $ b --url=https://github.com/user/repo.git --loc=plugin/path --name=name + $ lb + name https://github.com/user/repo.git plugin/path + +Keyword arguments, in reversed order. + + $ b --name=plugin-name --loc=path/of/plugin --url=user/repo + $ lb + plugin-name https://github.com/user/repo.git path/of/plugin + +Mixed positional and keyword arguments, and skip `loc`. + + $ b user/repo --name=plugin + plugin https://github.com/user/repo.git / + +Just `loc`, using keyword arguments. + + $ b --loc=plugin/path + path https://github.com/robbyrussell/oh-my-zsh.git plugin/path + +Just `name`, using keyword arguments. + + $ b --name=robby-oh-my-zsh + robby-oh-my-zsh https://github.com/robbyrussell/oh-my-zsh.git / -- 2.0.0