@@ -18,13 +18,14 @@ print_usage() {
1818 echo " Usage: $0 [OPTIONS]"
1919 echo " Options:"
2020 echo " -f, --filter PATTERN Filter tests by pattern (matches test descriptions)"
21- echo " -t, --type TYPE Test type: all, minimal, unit, or specific file path"
21+ echo " -t, --type TYPE Test type: all, minimal, unit, replay, or specific file path"
2222 echo " -h, --help Show this help message"
2323 echo " "
2424 echo " Examples:"
2525 echo " $0 # Run all tests"
2626 echo " $0 -f \" Timer\" # Run tests matching 'Timer'"
2727 echo " $0 -t unit # Run only unit tests"
28+ echo " $0 -t replay # Run only replay tests"
2829 echo " $0 -t tests/unit/timer_spec.lua # Run specific test file"
2930 echo " $0 -f \" creates a new timer\" -t unit # Filter unit tests"
3031}
@@ -72,8 +73,10 @@ echo "------------------------------------------------"
7273# Run tests based on type
7374minimal_status=0
7475unit_status=0
76+ replay_status=0
7577minimal_output=" "
7678unit_output=" "
79+ replay_output=" "
7780
7881if [ " $TEST_TYPE " = " all" ] || [ " $TEST_TYPE " = " minimal" ]; then
7982 # Run minimal tests
@@ -103,8 +106,22 @@ if [ "$TEST_TYPE" = "all" ] || [ "$TEST_TYPE" = "unit" ]; then
103106 echo " ------------------------------------------------"
104107fi
105108
109+ if [ " $TEST_TYPE " = " all" ] || [ " $TEST_TYPE " = " replay" ]; then
110+ # Run replay tests
111+ replay_output=$( nvim --headless -u tests/minimal/init.lua -c " lua require('plenary.test_harness').test_directory('./tests/replay', {minimal_init = './tests/minimal/init.lua'$FILTER_OPTION })" 2>&1 )
112+ replay_status=$?
113+ clean_output " $replay_output "
114+
115+ if [ $replay_status -eq 0 ]; then
116+ echo -e " ${GREEN} ✓ Replay tests passed${NC} "
117+ else
118+ echo -e " ${RED} ✗ Replay tests failed${NC} "
119+ fi
120+ echo " ------------------------------------------------"
121+ fi
122+
106123# Handle specific test file
107- if [ " $TEST_TYPE " != " all" ] && [ " $TEST_TYPE " != " minimal" ] && [ " $TEST_TYPE " != " unit" ]; then
124+ if [ " $TEST_TYPE " != " all" ] && [ " $TEST_TYPE " != " minimal" ] && [ " $TEST_TYPE " != " unit" ] && [ " $TEST_TYPE " != " replay " ] ; then
108125 # Assume it's a specific test file path
109126 if [ -f " $TEST_TYPE " ]; then
110127 specific_output=$( nvim --headless -u tests/minimal/init.lua -c " lua require('plenary.test_harness').test_directory('./$TEST_TYPE ', {minimal_init = './tests/minimal/init.lua'$FILTER_OPTION })" 2>&1 )
129146
130147# Check for any failures
131148all_output=" $minimal_output
132- $unit_output "
149+ $unit_output
150+ $replay_output "
133151
134- if [ $minimal_status -ne 0 ] || [ $unit_status -ne 0 ] || echo " $all_output " | grep -q " \[31mFail.*||" ; then
152+ if [ $minimal_status -ne 0 ] || [ $unit_status -ne 0 ] || [ $replay_status -ne 0 ] || echo " $all_output " | grep -q " \[31mFail.*||" ; then
135153 echo -e " \n${RED} ======== TEST FAILURES SUMMARY ========${NC} "
136154
137155 # Extract and format failures
0 commit comments