aboutsummaryrefslogtreecommitdiff
path: root/spec/cli/test_basic_options.sh
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-02-06 06:18:58 +0000
committerLi Jin <dragon-fly@qq.com>2026-02-06 06:18:58 +0000
commitaacf6dd9ebdb4d55b432ea1d4213093fe35e0ad1 (patch)
tree25926b10c10bc36133cfd1a337190dd003088e2e /spec/cli/test_basic_options.sh
parent1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d (diff)
downloadyuescript-aacf6dd9ebdb4d55b432ea1d4213093fe35e0ad1.tar.gz
yuescript-aacf6dd9ebdb4d55b432ea1d4213093fe35e0ad1.tar.bz2
yuescript-aacf6dd9ebdb4d55b432ea1d4213093fe35e0ad1.zip
test: add comprehensive CLI test suite
Add 56 test cases across 4 test suites to verify the yue command line tool functionality: - Basic options test: -h, --help, -v, --version flags - Compilation test: file/directory compilation with various options - Error handling test: syntax errors, file not found, edge cases - Execution test: -e option, script arguments, macros The test framework includes helper functions for assertions and test environment setup. All tests can be run via `bash spec/cli/run_all_tests.sh`. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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