aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-12-23 19:05:22 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-12-28 17:39:03 +0300
commit42ae47c3033a8c9ce70f1e6fb4c88ed70ac679fb (patch)
treebdd2cdbf35b4dfbfbc77763156182f03d497ad16 /tests
parentdc5296af63000cddc4b46fc205137c20578cb81f (diff)
Add repository type detection
Diffstat (limited to 'tests')
-rw-r--r--tests/rep-add.test84
1 files changed, 79 insertions, 5 deletions
diff --git a/tests/rep-add.test b/tests/rep-add.test
index a1b9104..28a7a20 100644
--- a/tests/rep-add.test
+++ b/tests/rep-add.test
@@ -7,6 +7,8 @@
: location
:
{
+ +$clone_cfg
+
: none
:
$* 2>>EOE != 0
@@ -14,17 +16,89 @@
info: run 'bpkg help rep-add' for more information
EOE
+ : empty
+ :
+ $* '' 2>>EOE != 0
+ error: empty repository location
+ EOE
+
+ : unknown-type
+ :
+ $* 'repo' --type unknown 2>>EOE != 0
+ error: invalid value 'unknown' for option '--type'
+ EOE
+
: no-version
:
- $* 'stable' 2>>EOE != 0
- error: invalid repository location 'stable': missing repository version
+ $* 'stable' 2>>/~%EOE% != 0
+ %error: invalid bpkg repository location '.+/no-version/stable': missing repository version%
+ info: consider using --type to specify repository type
EOE
- : invalid-host
+ : git-no-branch
:
- $* 'http://' 2>>EOE != 0
- error: invalid repository location 'http://': invalid host
+ $* 'git://example.org/repo' 2>>EOE != 0
+ error: invalid git repository location 'git://example.org/repo': missing branch/tag for git repository
EOE
+
+ : bpkg-git-scheme
+ :
+ $* 'git://example.org/repo' --type bpkg 2>>EOE != 0
+ error: invalid bpkg repository location 'git://example.org/repo': unsupported scheme for bpkg repository
+ EOE
+
+ : invalid-path
+ :
+ {
+ s="../../../../../../../../../../../../../../../../../../../../../../../"
+ s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s"
+ $* "$s" 2>>~%EOE% != 0
+ %error: invalid repository path '.+/': invalid filesystem path%
+ EOE
+ }
+
+ : type-detection
+ :
+ {
+ +$clone_cfg
+
+ : git-scheme
+ :
+ $clone_cfg;
+ $* 'git://example.org/repo#master' 2>>EOE
+ added repository example.org/repo
+ EOE
+
+ : http-git
+ :
+ $clone_cfg;
+ $* 'http://example.org/repo.git#master' 2>>EOE
+ added repository example.org/repo
+ EOE
+
+ : http-bpkg
+ :
+ $clone_cfg;
+ $* 'http://example.org/1/repo' 2>>EOE
+ added repository example.org/repo
+ EOE
+
+ : file-git
+ :
+ $clone_cfg && mkdir -p repo/.git;
+
+ $* 'repo' 2>>~%EOE% != 0
+ %error: invalid git repository location '.+repo': missing branch/tag for git repository%
+ EOE
+
+ : file-bpkg
+ :
+ $clone_cfg;
+
+ $* '1/repo' 2>>/~%EOE%
+ %added repository .+/repo%
+ EOE
+ }
}
: relative-path