summaryrefslogtreecommitdiff
path: root/eclass/tests/git-r3_subrepos.sh
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /eclass/tests/git-r3_subrepos.sh
reinit the tree, so we can have metadata
Diffstat (limited to 'eclass/tests/git-r3_subrepos.sh')
-rwxr-xr-xeclass/tests/git-r3_subrepos.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/eclass/tests/git-r3_subrepos.sh b/eclass/tests/git-r3_subrepos.sh
new file mode 100755
index 000000000000..5b814328a49e
--- /dev/null
+++ b/eclass/tests/git-r3_subrepos.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+source tests-common.sh
+
+inherit git-r3
+
+# Test getting submodule URIs
+test_subrepos() {
+ local suburi=${1}
+ local expect=( "${@:2}" )
+
+ tbegin "subrepos for ${suburi} -> ${expect[0]}${expect[1]+...}"
+
+ local subrepos
+ _git-r3_set_subrepos "${suburi}" "${repos[@]}"
+
+ [[ ${expect[@]} == ${subrepos[@]} ]]
+ tend ${?} || eerror "Expected: ${expect[@]}, got: ${subrepos[@]}"
+}
+
+# parent repos
+repos=( http://foohub/fooman/foo.git git://foohub/fooman/foo.git )
+
+# absolute URI
+test_subrepos http://foo/bar http://foo/bar
+test_subrepos /foo/bar /foo/bar
+
+# plain relative URI
+test_subrepos ./baz http://foohub/fooman/foo.git/baz git://foohub/fooman/foo.git/baz
+
+# backward relative URIs
+test_subrepos ../baz.git http://foohub/fooman/baz.git git://foohub/fooman/baz.git
+test_subrepos ../../bazman/baz.git http://foohub/bazman/baz.git git://foohub/bazman/baz.git
+
+texit