'Generic Commit'
Some checks failed
Build-Test-Publish / build (push) Has been cancelled

This commit is contained in:
Your Name
2025-06-15 21:00:52 +12:00
parent 1362f03462
commit 0622b250cc
2 changed files with 212 additions and 152 deletions

View File

@ -66,13 +66,17 @@ fi
# Test 2: Running with a valid directory should save config
echo -e "\nTest 2: First run with directory argument"
TEST_DIR="/home/j/code"
# Use a directory that should exist in most environments
TEST_DIR="/tmp"
if [ -d "$TEST_DIR" ]; then
"$WHATSDIRTY_SCRIPT" "$TEST_DIR" > /dev/null 2>&1
if [ -f "$CONFIG_FILE" ] && [ "$(cat "$CONFIG_FILE")" = "$TEST_DIR" ]; then
print_test "Directory saved to config" "PASS"
else
print_test "Directory saved to config" "FAIL"
echo " Expected config to contain: $TEST_DIR"
echo " Config file exists: $([ -f "$CONFIG_FILE" ] && echo "yes" || echo "no")"
[ -f "$CONFIG_FILE" ] && echo " Config contains: $(cat "$CONFIG_FILE")"
fi
else
print_test "Directory saved to config" "SKIP (test directory not found)"
@ -80,10 +84,13 @@ fi
# Test 3: Running without arguments should use saved directory
echo -e "\nTest 3: Subsequent run without arguments"
if "$WHATSDIRTY_SCRIPT" > /dev/null 2>&1; then
OUTPUT=$("$WHATSDIRTY_SCRIPT" 2>&1 || true)
# Should not contain error message about no directory
if ! echo "$OUTPUT" | grep -q "Error:" && [ -f "$CONFIG_FILE" ]; then
print_test "Uses saved directory from config" "PASS"
else
print_test "Uses saved directory from config" "FAIL"
echo " Output: $OUTPUT"
fi
# Test 4: Running with new directory should update config