diff options
Diffstat (limited to 'spec/cli/test_basic_options.sh')
| -rwxr-xr-x | spec/cli/test_basic_options.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/cli/test_basic_options.sh b/spec/cli/test_basic_options.sh new file mode 100755 index 0000000..81cfaf7 --- /dev/null +++ b/spec/cli/test_basic_options.sh | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Test Basic Options for YueScript CLI | ||
| 3 | # Tests: -h, --help, -v, --version | ||
| 4 | |||
| 5 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| 6 | source "$SCRIPT_DIR/cli_test_helper.sh" | ||
| 7 | |||
| 8 | # Check binary | ||
| 9 | check_yue_binary | ||
| 10 | |||
| 11 | echo "========================================" | ||
| 12 | echo "Testing Basic Options" | ||
| 13 | echo "========================================" | ||
| 14 | echo "" | ||
| 15 | |||
| 16 | # Test 1: Help flag -h | ||
| 17 | echo "Testing -h flag..." | ||
| 18 | assert_output_contains "Help flag -h should show usage" "Usage: yue" $YUE_BIN -h | ||
| 19 | |||
| 20 | # Test 2: Help flag --help | ||
| 21 | assert_output_contains "Help flag --help should show usage" "Usage: yue" $YUE_BIN --help | ||
| 22 | |||
| 23 | # Test 3: Version flag -v | ||
| 24 | assert_output_contains "Version flag -v should show version" "Yuescript version:" $YUE_BIN -v | ||
| 25 | |||
| 26 | # Test 4: Version flag --version | ||
| 27 | assert_output_contains "Version flag --version should show version" "Yuescript version:" $YUE_BIN --version | ||
| 28 | |||
| 29 | # Test 5: Verify help contains expected sections | ||
| 30 | echo "" | ||
| 31 | echo "Testing help content..." | ||
| 32 | # Use grep -F to search for fixed strings without interpreting special characters | ||
| 33 | assert_output_contains "Help should show compile options" "output-to" $YUE_BIN --help | ||
| 34 | assert_output_contains "Help should show minify option" "minify" $YUE_BIN --help | ||
| 35 | assert_output_contains "Help should show execute option" "execute" $YUE_BIN --help | ||
| 36 | |||
| 37 | echo "" | ||
| 38 | print_summary | ||
