aboutsummaryrefslogtreecommitdiff
path: root/spec/cli/test_basic_options.sh
diff options
context:
space:
mode:
Diffstat (limited to 'spec/cli/test_basic_options.sh')
-rwxr-xr-xspec/cli/test_basic_options.sh38
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
5SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6source "$SCRIPT_DIR/cli_test_helper.sh"
7
8# Check binary
9check_yue_binary
10
11echo "========================================"
12echo "Testing Basic Options"
13echo "========================================"
14echo ""
15
16# Test 1: Help flag -h
17echo "Testing -h flag..."
18assert_output_contains "Help flag -h should show usage" "Usage: yue" $YUE_BIN -h
19
20# Test 2: Help flag --help
21assert_output_contains "Help flag --help should show usage" "Usage: yue" $YUE_BIN --help
22
23# Test 3: Version flag -v
24assert_output_contains "Version flag -v should show version" "Yuescript version:" $YUE_BIN -v
25
26# Test 4: Version flag --version
27assert_output_contains "Version flag --version should show version" "Yuescript version:" $YUE_BIN --version
28
29# Test 5: Verify help contains expected sections
30echo ""
31echo "Testing help content..."
32# Use grep -F to search for fixed strings without interpreting special characters
33assert_output_contains "Help should show compile options" "output-to" $YUE_BIN --help
34assert_output_contains "Help should show minify option" "minify" $YUE_BIN --help
35assert_output_contains "Help should show execute option" "execute" $YUE_BIN --help
36
37echo ""
38print_summary