@@ -153,10 +153,29 @@ test_snapshot_stripping() {
153153 fi
154154}
155155
156- # Test 3: Full script execution in test environment
156+ # Test 3: Script accepts version argument
157+ test_version_argument () {
158+ TESTS_RUN=$(( TESTS_RUN + 1 ))
159+ info " Test 3: Script accepts version argument"
160+
161+ # Change to test directory to ensure we're not in repo root
162+ cd " $TEST_DIR "
163+
164+ # Run script with explicit version argument
165+ local output=$( bash " $SCRIPT_UNDER_TEST " " 9.9.9" 2>&1 )
166+
167+ if echo " $output " | grep -q " Using version from argument: 9.9.9" ; then
168+ pass " Script accepts and uses version argument"
169+ else
170+ fail " Version argument handling" " script should accept version argument" " script did not recognize argument"
171+ echo " Output was: $output " | head -5
172+ fi
173+ }
174+
175+ # Test 4: Full script execution in test environment
157176test_full_script_execution () {
158177 TESTS_RUN=$(( TESTS_RUN + 1 ))
159- info " Test 3 : Full script execution"
178+ info " Test 4 : Full script execution"
160179
161180 # Create a modified version of the script that operates in TEST_DIR
162181 local test_script=" /tmp/test-script-$$ .sh"
@@ -180,10 +199,10 @@ test_full_script_execution() {
180199 rm -f /tmp/test-output-$$ .log " $test_script "
181200}
182201
183- # Test 4 : Version pattern matching
202+ # Test 5 : Version pattern matching
184203test_version_pattern_matching () {
185204 TESTS_RUN=$(( TESTS_RUN + 1 ))
186- info " Test 4 : Version pattern matching"
205+ info " Test 5 : Version pattern matching"
187206
188207 # Test the sed pattern used in the script on a sample
189208 local sample=' <dependency><version>1.0.0</version></dependency>'
@@ -197,10 +216,10 @@ test_version_pattern_matching() {
197216 fi
198217}
199218
200- # Test 5 : Selective replacement (only in dependency blocks)
219+ # Test 6 : Selective replacement (only in dependency blocks)
201220test_selective_replacement () {
202221 TESTS_RUN=$(( TESTS_RUN + 1 ))
203- info " Test 5 : Selective replacement"
222+ info " Test 6 : Selective replacement"
204223
205224 # Create a test file
206225 cat > /tmp/test-selective-$$ .md << 'EOF '
@@ -231,10 +250,10 @@ EOF
231250 fi
232251}
233252
234- # Test 6 : Script handles errors gracefully
253+ # Test 7 : Script handles errors gracefully
235254test_error_handling () {
236255 TESTS_RUN=$(( TESTS_RUN + 1 ))
237- info " Test 6 : Script handles errors gracefully"
256+ info " Test 7 : Script handles errors gracefully"
238257
239258 # Test that script handles missing files gracefully
240259 cd " $TEST_DIR "
@@ -271,6 +290,7 @@ main() {
271290 # Run tests
272291 test_version_extraction
273292 test_snapshot_stripping
293+ test_version_argument
274294 test_full_script_execution
275295 test_version_pattern_matching
276296 test_selective_replacement
0 commit comments