aboutsummaryrefslogtreecommitdiffstats
path: root/test-logic.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test-logic.sh')
-rwxr-xr-xtest-logic.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/test-logic.sh b/test-logic.sh
index 423d2b5..cbdef9d 100755
--- a/test-logic.sh
+++ b/test-logic.sh
@@ -152,6 +152,28 @@ echo "$ex" | grep -qx -- "--exclude=/pentesting/" && ok "rsync_excludes pentesti
declare -A SBO_PERSONAL_TREES=()
[[ -z "$(rsync_excludes)" ]] && ok "rsync_excludes empty for no trees" || bad "rsync_excludes should be empty, got [$(rsync_excludes)]"
+# --- collect_shadows: upstream dups of personal packages -------------------
+S=$(mktemp -d)
+mkslb() { mkdir -p "$S/$1/$2"; : > "$S/$1/$2/$2.SlackBuild"; }
+# upstream copies
+mkslb academic foo
+mkslb network bar
+# personal copies (win)
+mkslb personal foo
+mkslb pentesting bar
+# decoy: personal pkg with no upstream twin
+mkslb personal nomatch
+# decoy: personal subdir without a .SlackBuild (ignored)
+mkdir -p "$S/personal/noslb"
+declare -A SBO_PERSONAL_TREES=([personal]=u1 [pentesting]=u2)
+
+got="$(collect_shadows "$S" | sort)"
+want="$(printf 'academic/foo\nnetwork/bar\n' | sort)"
+[[ "$got" == "$want" ]] && ok "collect_shadows finds upstream dups only" || bad "collect_shadows wrong; got [$got] want [$want]"
+echo "$got" | grep -q "personal/" && bad "collect_shadows returned a personal path" || ok "collect_shadows excludes personal trees"
+echo "$got" | grep -q "nomatch" && bad "collect_shadows invented a match for nomatch" || ok "collect_shadows ignores no-twin pkg"
+rm -rf "$S"
+
# --- result -----------------------------------------------------------------
echo
echo "$pass passed, $fail failed"