From 2bfb91a0e5e81397ab94eeab71e4506b81c98989 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Fri, 25 Sep 2026 11:54:16 +0200 Subject: [PATCH] add test create symlink error --- src/albentohandy | 4 +++- tests/albentohandy.bats | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/albentohandy b/src/albentohandy index 21848f0..e9bd782 100755 --- a/src/albentohandy +++ b/src/albentohandy @@ -53,7 +53,9 @@ make_symlinks_to_work() cp --recursive \ --symbolic-link \ "$MUSIC_PATH/$album" \ - "$OUTPUT_PATH" + "$OUTPUT_PATH" \ + || errlog "could not create symlinks for $album" \ + || return $? done } diff --git a/tests/albentohandy.bats b/tests/albentohandy.bats index 32ec11a..88a6d69 100755 --- a/tests/albentohandy.bats +++ b/tests/albentohandy.bats @@ -142,4 +142,18 @@ teardown() { assert_success [ -h "build/tests/output/Artist1/file.flac" ] +} + +@test "failed: create symlink for Alben/Artist1/file.flac" { + mkdir --parents "build/tests/output" + mkdir --parents "build/tests/music/Alben/Artist1" + echo "testfile" > "build/tests/music/Alben/Artist1/file.flac" + cp() { + return 1 + } + + run main -i "build/tests/albumlist" + + assert_failure + assert_line --index 0 "❌ ERROR: could not create symlinks for Alben/Artist1" } \ No newline at end of file -- 2.47.3