summaryrefslogtreecommitdiff
path: root/tests/cli.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-05 22:57:10 +0300
committerPaul Buetow <paul@buetow.org>2026-06-05 22:57:10 +0300
commitebf564c546f081734c612c481857fc4ab30f1b9a (patch)
tree6e9d8d74694b1146586a5b524fd6537f98c87bf9 /tests/cli.sh
parentce3c1f9ffeffc0b57f46fc21ff1505581d0d199e (diff)
Fix init config template path replacement
Diffstat (limited to 'tests/cli.sh')
-rwxr-xr-xtests/cli.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/cli.sh b/tests/cli.sh
index 2911741..d6e2787 100755
--- a/tests/cli.sh
+++ b/tests/cli.sh
@@ -180,6 +180,34 @@ test_init() {
test::teardown
}
+test_init_with_hash_in_source_path() {
+ local config
+ local output_dir
+ local repo_dir
+
+ test::setup
+ repo_dir="$TEST_TMPDIR/repo#with-hash"
+ output_dir="$TEST_TMPDIR/output"
+ mkdir -p "$repo_dir" "$output_dir"
+ cp -R \
+ "$TEST_REPO_ROOT/bin" \
+ "$TEST_REPO_ROOT/share" \
+ "$TEST_REPO_ROOT/src" \
+ "$repo_dir/"
+
+ (
+ cd "$output_dir"
+ PHOTOALBUM_DEFAULT_RC="$TEST_TMPDIR/missing" \
+ "$repo_dir/bin/photoalbum" --init >/dev/null
+ test::assert_file_exists photoalbum.conf
+ )
+ config=$(<"$output_dir/photoalbum.conf")
+ test::assert_contains \
+ "TEMPLATE_DIR=$repo_dir/share/templates/default" \
+ "$config"
+ test::teardown
+}
+
test_init_existing_config_fails_without_overwrite() {
local output
@@ -3098,6 +3126,9 @@ main() {
test::run_case '--version succeeds' test_version
test::run_case '--init succeeds' test_init
test::run_case \
+ '--init succeeds when source path contains #' \
+ test_init_with_hash_in_source_path
+ test::run_case \
'--init refuses existing config without overwrite' \
test_init_existing_config_fails_without_overwrite
test::run_case \