diff options
Diffstat (limited to 'js/scripting-lang/run_tests.sh')
-rwxr-xr-x | js/scripting-lang/run_tests.sh | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/js/scripting-lang/run_tests.sh b/js/scripting-lang/run_tests.sh deleted file mode 100755 index 1f6c848..0000000 --- a/js/scripting-lang/run_tests.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash - -# Test Runner for Simple Scripting Language -# Runs unit tests and integration tests systematically - -echo "=== Simple Scripting Language Test Suite ===" -echo "" - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -NC='\033[0m' # No Color - -# Function to run a test -run_test() { - local test_file=$1 - local test_name=$2 - - echo -n "Running $test_name... " - - # Capture both stdout and stderr, and get the exit code - local output - local exit_code - output=$(DEBUG="$DEBUG" bun lang.js "$test_file" 2>&1) - exit_code=$? - - if [ $exit_code -eq 0 ]; then - echo -e "${GREEN}PASS${NC}" - # Show debug output if DEBUG is set - if [ -n "$DEBUG" ]; then - echo "$output" - fi - return 0 - else - echo -e "${RED}FAIL${NC}" - echo -e "${RED}Error:${NC} $output" - return 1 - fi -} - -# Function to run a test with output -run_test_with_output() { - local test_file=$1 - local test_name=$2 - - echo -e "${YELLOW}=== $test_name ===${NC}" - DEBUG="$DEBUG" bun lang.js "$test_file" - echo "" -} - -# Counters -total_tests=0 -passed_tests=0 -failed_tests=0 - -echo "Running Unit Tests..." -echo "====================" - -# Unit tests -unit_tests=( - "tests/01_lexer_basic.txt:Basic Lexer" - "tests/02_arithmetic_operations.txt:Arithmetic Operations" - "tests/03_comparison_operators.txt:Comparison Operators" - "tests/04_logical_operators.txt:Logical Operators" - "tests/05_io_operations.txt:IO Operations" - "tests/06_function_definitions.txt:Function Definitions" - "tests/07_case_expressions.txt:Case Expressions" - "tests/08_first_class_functions.txt:First-Class Functions" - "tests/09_tables.txt:Tables" - "tests/10_standard_library.txt:Standard Library" - "tests/11_edge_cases.txt:Edge Cases" - "tests/12_advanced_tables.txt:Advanced Tables" - "tests/13_standard_library_complete.txt:Complete Standard Library" - "tests/14_error_handling.txt:Error Handling" - "tests/15_performance_stress.txt:Performance and Stress" - "tests/16_function_composition.txt:Advanced Functional Programming" - "tests/17_table_enhancements.txt:Table Enhancements" - "tests/18_each_combinator.txt:Each Combinator" - "tests/19_embedded_functions.txt:Embedded Functions" - "tests/20_via_operator.txt:Via Operator" - "tests/21_enhanced_case_statements.txt:Enhanced Case Statements" - "tests/22_parser_limitations.txt:Parser Limitations" - "tests/23_minus_operator_spacing.txt:Minus Operator Spacing" -) - -for test in "${unit_tests[@]}"; do - IFS=':' read -r file name <<< "$test" - total_tests=$((total_tests + 1)) - - if run_test "$file" "$name"; then - passed_tests=$((passed_tests + 1)) - else - failed_tests=$((failed_tests + 1)) - fi -done - -echo "" -echo "Running Integration Tests..." -echo "===========================" - -# Integration tests -integration_tests=( - "tests/integration_01_basic_features.txt:Basic Features Integration" - "tests/integration_02_pattern_matching.txt:Pattern Matching Integration" - "tests/integration_03_functional_programming.txt:Functional Programming Integration" - "tests/integration_04_mini_case_multi_param.txt:Multi-parameter case expression at top level" -) - -for test in "${integration_tests[@]}"; do - IFS=':' read -r file name <<< "$test" - total_tests=$((total_tests + 1)) - - if run_test "$file" "$name"; then - passed_tests=$((passed_tests + 1)) - else - failed_tests=$((failed_tests + 1)) - fi -done - -echo "" -echo "=== Test Summary ===" -echo "Total tests: $total_tests" -echo -e "Passed: ${GREEN}$passed_tests${NC}" -echo -e "Failed: ${RED}$failed_tests${NC}" - -if [ $failed_tests -eq 0 ]; then - echo -e "${GREEN}All tests passed!${NC}" - exit 0 -else - echo -e "${RED}Some tests failed.${NC}" - exit 1 -fi \ No newline at end of file |