aboutsummaryrefslogtreecommitdiff
path: root/spec/cli/run_all_tests.sh
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-02-06 06:32:06 +0000
committerLi Jin <dragon-fly@qq.com>2026-02-06 06:32:06 +0000
commitcfba0fb6368ceae9489bcbfeaabc75b04bdcaeb6 (patch)
tree157485438aab0aaadfb5a55b15e0c393f391137c /spec/cli/run_all_tests.sh
parentb018d86d32f0160006aaf9930d8d61b7eacefda4 (diff)
downloadyuescript-cfba0fb6368ceae9489bcbfeaabc75b04bdcaeb6.tar.gz
yuescript-cfba0fb6368ceae9489bcbfeaabc75b04bdcaeb6.tar.bz2
yuescript-cfba0fb6368ceae9489bcbfeaabc75b04bdcaeb6.zip
test: improve CLI test summary table formatting
Optimize test results display for better readability: - Use ASCII box characters for better terminal compatibility - Improve column alignment and spacing - Remove redundant symbols in status column (PASS/FAIL only) - Left-align labels, right-align numbers in statistics table - Add color-coded pass rate (green 100%, yellow 80%+, red <80%) - Enhance final verdict section with indentation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to '')
-rwxr-xr-xspec/cli/run_all_tests.sh66
1 files changed, 36 insertions, 30 deletions
diff --git a/spec/cli/run_all_tests.sh b/spec/cli/run_all_tests.sh
index a095796..8e5fb6d 100755
--- a/spec/cli/run_all_tests.sh
+++ b/spec/cli/run_all_tests.sh
@@ -110,16 +110,16 @@ run_test_suite "Execution Test" "$SCRIPT_DIR/test_execution.sh"
110 110
111# Print detailed summary 111# Print detailed summary
112echo "" 112echo ""
113echo -e "${CYAN}╔════════════════════════════════════════════════════════╗" 113echo -e "${BLUE}═══════════════════════════════════════════════════════════"
114echo " YueScript CLI Test Results Summary" 114echo " YueScript CLI Test Results Summary"
115echo "╚════════════════════════════════════════════════════════╝${NC}" 115echo "═══════════════════════════════════════════════════════════${NC}"
116echo "" 116echo ""
117 117
118# Print per-suite statistics 118# Print per-suite statistics
119echo -e "${CYAN}Test Suite Details:${NC}" 119echo -e "${CYAN}Test Suite Details:${NC}"
120echo "┌────────────────────────────────┬────────┬────────┬────────┬──────────┐" 120echo "┌──────────────────────────────┬───────┬────────┬────────┬─────────┐"
121echo "│ Test Suite │ Total │ Passed │ Failed │ Status │" 121echo "│ Test Suite │ Total │ Passed │ Failed │ Status │"
122echo "├────────────────────────────────┼────────┼────────┼────────┼──────────┤" 122echo "├──────────────────────────────┼───────┼────────┼────────┼─────────┤"
123 123
124for ((i=0; i<TOTAL_SUITES; i++)); do 124for ((i=0; i<TOTAL_SUITES; i++)); do
125 name="${SUITE_NAMES[$i]}" 125 name="${SUITE_NAMES[$i]}"
@@ -129,50 +129,56 @@ for ((i=0; i<TOTAL_SUITES; i++)); do
129 status="${SUITE_STATUS[$i]}" 129 status="${SUITE_STATUS[$i]}"
130 130
131 # Format suite name (truncate if too long) 131 # Format suite name (truncate if too long)
132 name_display=$(printf "%.30s" "$name") 132 name_display=$(printf "%.28s" "$name")
133 printf "│ %-30s │ %6d │ %6d │ %6d │ " "$name_display" $total $passed $failed 133 printf "│ %-28s │ %5d │ %6d │ %6d │ " "$name_display" $total $passed $failed
134 134
135 if [ "$status" = "PASS" ]; then 135 if [ "$status" = "PASS" ]; then
136 echo -e "${GREEN}PASS ${NC}│" 136 echo -e "${GREEN}PASS ${NC}│"
137 else 137 else
138 echo -e "${RED}FAIL ${NC}│" 138 echo -e "${RED}FAIL ${NC}│"
139 fi 139 fi
140done 140done
141 141
142echo "└────────────────────────────────┴────────┴────────┴────────┴──────────┘" 142echo "└──────────────────────────────┴───────┴────────┴────────┴─────────┘"
143echo "" 143echo ""
144 144
145# Print overall statistics 145# Print overall statistics
146echo -e "${CYAN}Overall Statistics:${NC}" 146echo -e "${CYAN}Overall Statistics:${NC}"
147echo "┌─────────────────────────────────────────────────────────────────┐" 147echo "┌────────────────────────────────────────────────────────────┐"
148printf "│ Total Test Suites: %3d │\n" $TOTAL_SUITES 148printf "│ Total Test Suites: %3d │\n" $TOTAL_SUITES
149printf "│ Passed Test Suites: %3d │\n" $PASSED_SUITES 149printf "│ Passed Test Suites: %3d │\n" $PASSED_SUITES
150printf "│ Failed Test Suites: %3d │\n" $FAILED_SUITES 150printf "│ Failed Test Suites: %3d │\n" $FAILED_SUITES
151echo "├─────────────────────────────────────────────────────────────────┤" 151echo "├────────────────────────────────────────────────────────────┤"
152printf "│ Total Test Cases: %3d │\n" $TOTAL_TESTS 152printf "│ Total Test Cases: %3d │\n" $TOTAL_TESTS
153printf "│ Passed Test Cases: %3d │\n" $TOTAL_PASSED 153printf "│ Passed Test Cases: %3d │\n" $TOTAL_PASSED
154printf "│ Failed Test Cases: %3d │\n" $TOTAL_FAILED 154printf "│ Failed Test Cases: %3d │\n" $TOTAL_FAILED
155echo "└─────────────────────────────────────────────────────────────────┘" 155echo "└────────────────────────────────────────────────────────────┘"
156echo ""
157 156
158# Calculate pass rate 157# Calculate pass rate
159if [ $TOTAL_TESTS -gt 0 ]; then 158if [ $TOTAL_TESTS -gt 0 ]; then
160 pass_rate=$((TOTAL_PASSED * 100 / TOTAL_TESTS)) 159 pass_rate=$((TOTAL_PASSED * 100 / TOTAL_TESTS))
161 echo -e "Overall Pass Rate: ${CYAN}$pass_rate%%${NC}" 160 printf " Overall Pass Rate: "
162 echo "" 161 if [ $pass_rate -eq 100 ]; then
162 echo -e "${GREEN}${pass_rate}%%${NC}"
163 elif [ $pass_rate -ge 80 ]; then
164 echo -e "${YELLOW}${pass_rate}%%${NC}"
165 else
166 echo -e "${RED}${pass_rate}%%${NC}"
167 fi
163fi 168fi
169echo ""
164 170
165# Final verdict 171# Final verdict
166echo -e "${BLUE}======================================" 172echo -e "${BLUE}═══════════════════════════════════════════════════════════"
167echo "Final Verdict" 173echo " Final Verdict"
168echo "======================================${NC}" 174echo "═══════════════════════════════════════════════════════════${NC}"
169 175
170if [ $FAILED_SUITES -eq 0 ]; then 176if [ $FAILED_SUITES -eq 0 ]; then
171 echo -e "${GREEN}✓ All test suites passed!${NC}" 177 echo -e "${GREEN} ✓ All test suites passed!${NC}"
172 echo -e "${GREEN}✓ All $TOTAL_TESTS test cases passed!${NC}" 178 echo -e "${GREEN} ✓ All $TOTAL_TESTS test cases passed!${NC}"
173 exit 0 179 exit 0
174else 180else
175 echo -e "${RED}✗ $FAILED_SUITES test suite(s) failed${NC}" 181 echo -e "${RED} ✗ $FAILED_SUITES test suite(s) failed${NC}"
176 echo -e "${RED}✗ $TOTAL_FAILED test case(s) failed${NC}" 182 echo -e "${RED} ✗ $TOTAL_FAILED test case(s) failed${NC}"
177 exit 1 183 exit 1
178fi 184fi