From 1c93c88a3f79cfce68ee6d8c4cd85156aaad1101 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 20 Feb 2026 13:02:09 +0000 Subject: Add test suite for reserve comments feature - Add assert_output_not_contains helper function for negative assertions - Add reserve_comments_spec test with Yue and Lua files - Integrate new test suite into run_all_tests.sh Co-Authored-By: Claude Sonnet 4.5 --- spec/cli/cli_test_helper.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'spec/cli/cli_test_helper.sh') diff --git a/spec/cli/cli_test_helper.sh b/spec/cli/cli_test_helper.sh index ade1546..0f46969 100755 --- a/spec/cli/cli_test_helper.sh +++ b/spec/cli/cli_test_helper.sh @@ -123,6 +123,33 @@ assert_output_equals() { fi } +# Assert that output does NOT contain expected string +assert_output_not_contains() { + local description="$1" + local unexpected="$2" + shift 2 + TESTS_RUN=$((TESTS_RUN + 1)) + + if "$@" > /tmp/test_stdout.txt 2> /tmp/test_stderr.txt; then + if grep -qF -- "$unexpected" /tmp/test_stdout.txt || grep -qF -- "$unexpected" /tmp/test_stderr.txt; then + echo -e "${RED}✗${NC} $description (output contains '$unexpected')" + echo -e " ${YELLOW}STDOUT:$(cat /tmp/test_stdout.txt)${NC}" + echo -e " ${YELLOW}STDERR:$(cat /tmp/test_stderr.txt)${NC}" + TESTS_FAILED=$((TESTS_FAILED + 1)) + return 1 + else + echo -e "${GREEN}✓${NC} $description" + TESTS_PASSED=$((TESTS_PASSED + 1)) + return 0 + fi + else + echo -e "${RED}✗${NC} $description (command failed)" + echo -e " ${YELLOW}Exit code: $?${NC}" + TESTS_FAILED=$((TESTS_FAILED + 1)) + return 1 + fi +} + # Assert file exists assert_file_exists() { local description="$1" -- cgit v1.2.3-55-g6feb