@@ -219,11 +219,11 @@ test_p1_exit_code_126() { |
| 219 | 219 | section "P1-1: Exit Code 126 (Non-executable File)" |
| 220 | 220 | |
| 221 | 221 | # Test 1: Non-executable file returns 126 |
| 222 | | - touch /tmp/fortsh_test_nonexec |
| 223 | | - chmod 644 /tmp/fortsh_test_nonexec |
| 224 | | - $SHELL_BIN -c '/tmp/fortsh_test_nonexec' >/dev/null 2>&1 |
| 222 | + touch /tmp/bensch_test_nonexec |
| 223 | + chmod 644 /tmp/bensch_test_nonexec |
| 224 | + $SHELL_BIN -c '/tmp/bensch_test_nonexec' >/dev/null 2>&1 |
| 225 | 225 | exit_code=$? |
| 226 | | - rm -f /tmp/fortsh_test_nonexec |
| 226 | + rm -f /tmp/bensch_test_nonexec |
| 227 | 227 | |
| 228 | 228 | if [ $exit_code -eq 126 ]; then |
| 229 | 229 | pass "P1-1.1: Non-executable file returns exit code 126" |
@@ -240,12 +240,12 @@ test_p1_exit_code_126() { |
| 240 | 240 | fi |
| 241 | 241 | |
| 242 | 242 | # Test 3: Executable file returns its own exit code |
| 243 | | - echo '#!/bin/sh' > /tmp/fortsh_test_exec |
| 244 | | - echo 'exit 5' >> /tmp/fortsh_test_exec |
| 245 | | - chmod 755 /tmp/fortsh_test_exec |
| 246 | | - $SHELL_BIN -c '/tmp/fortsh_test_exec' >/dev/null 2>&1 |
| 243 | + echo '#!/bin/sh' > /tmp/bensch_test_exec |
| 244 | + echo 'exit 5' >> /tmp/bensch_test_exec |
| 245 | + chmod 755 /tmp/bensch_test_exec |
| 246 | + $SHELL_BIN -c '/tmp/bensch_test_exec' >/dev/null 2>&1 |
| 247 | 247 | exit_code=$? |
| 248 | | - rm -f /tmp/fortsh_test_exec |
| 248 | + rm -f /tmp/bensch_test_exec |
| 249 | 249 | |
| 250 | 250 | if [ $exit_code -eq 5 ]; then |
| 251 | 251 | pass "P1-1.3: Executable file returns its own exit code" |
@@ -258,11 +258,11 @@ test_p1_set_c_noclobber() { |
| 258 | 258 | section "P1-2: set -C (noclobber option)" |
| 259 | 259 | |
| 260 | 260 | # Test 1: set -C prevents overwriting existing files |
| 261 | | - echo "original" > /tmp/fortsh_test_noclobber |
| 262 | | - $SHELL_BIN -c 'set -C; echo new > /tmp/fortsh_test_noclobber' >/dev/null 2>&1 |
| 261 | + echo "original" > /tmp/bensch_test_noclobber |
| 262 | + $SHELL_BIN -c 'set -C; echo new > /tmp/bensch_test_noclobber' >/dev/null 2>&1 |
| 263 | 263 | exit_code=$? |
| 264 | | - content=$(cat /tmp/fortsh_test_noclobber 2>/dev/null) |
| 265 | | - rm -f /tmp/fortsh_test_noclobber |
| 264 | + content=$(cat /tmp/bensch_test_noclobber 2>/dev/null) |
| 265 | + rm -f /tmp/bensch_test_noclobber |
| 266 | 266 | |
| 267 | 267 | if [ $exit_code -ne 0 ] && [ "$content" = "original" ]; then |
| 268 | 268 | pass "P1-2.1: set -C prevents overwriting existing files" |
@@ -271,20 +271,20 @@ test_p1_set_c_noclobber() { |
| 271 | 271 | fi |
| 272 | 272 | |
| 273 | 273 | # Test 2: set -C allows writing to new files |
| 274 | | - rm -f /tmp/fortsh_test_noclobber_new |
| 275 | | - $SHELL_BIN -c 'set -C; echo content > /tmp/fortsh_test_noclobber_new' >/dev/null 2>&1 |
| 276 | | - if [ -f /tmp/fortsh_test_noclobber_new ]; then |
| 274 | + rm -f /tmp/bensch_test_noclobber_new |
| 275 | + $SHELL_BIN -c 'set -C; echo content > /tmp/bensch_test_noclobber_new' >/dev/null 2>&1 |
| 276 | + if [ -f /tmp/bensch_test_noclobber_new ]; then |
| 277 | 277 | pass "P1-2.2: set -C allows writing to non-existent files" |
| 278 | | - rm -f /tmp/fortsh_test_noclobber_new |
| 278 | + rm -f /tmp/bensch_test_noclobber_new |
| 279 | 279 | else |
| 280 | 280 | fail "P1-2.2: set -C allows writing to non-existent files" |
| 281 | 281 | fi |
| 282 | 282 | |
| 283 | 283 | # Test 3: >| forces overwrite even with noclobber |
| 284 | | - echo "original" > /tmp/fortsh_test_force |
| 285 | | - $SHELL_BIN -c 'set -C; echo forced >| /tmp/fortsh_test_force' >/dev/null 2>&1 |
| 286 | | - content=$(cat /tmp/fortsh_test_force 2>/dev/null) |
| 287 | | - rm -f /tmp/fortsh_test_force |
| 284 | + echo "original" > /tmp/bensch_test_force |
| 285 | + $SHELL_BIN -c 'set -C; echo forced >| /tmp/bensch_test_force' >/dev/null 2>&1 |
| 286 | + content=$(cat /tmp/bensch_test_force 2>/dev/null) |
| 287 | + rm -f /tmp/bensch_test_force |
| 288 | 288 | |
| 289 | 289 | if [ "$content" = "forced" ]; then |
| 290 | 290 | pass "P1-2.3: >| forces overwrite with noclobber set" |
@@ -293,10 +293,10 @@ test_p1_set_c_noclobber() { |
| 293 | 293 | fi |
| 294 | 294 | |
| 295 | 295 | # Test 4: set +C disables noclobber |
| 296 | | - echo "original" > /tmp/fortsh_test_disable |
| 297 | | - $SHELL_BIN -c 'set -C; set +C; echo new > /tmp/fortsh_test_disable' >/dev/null 2>&1 |
| 298 | | - content=$(cat /tmp/fortsh_test_disable 2>/dev/null) |
| 299 | | - rm -f /tmp/fortsh_test_disable |
| 296 | + echo "original" > /tmp/bensch_test_disable |
| 297 | + $SHELL_BIN -c 'set -C; set +C; echo new > /tmp/bensch_test_disable' >/dev/null 2>&1 |
| 298 | + content=$(cat /tmp/bensch_test_disable 2>/dev/null) |
| 299 | + rm -f /tmp/bensch_test_disable |
| 300 | 300 | |
| 301 | 301 | if [ "$content" = "new" ]; then |
| 302 | 302 | pass "P1-2.4: set +C disables noclobber option" |
@@ -422,9 +422,9 @@ test_p2_dot_with_args() { |
| 422 | 422 | section "P2-2: dot (.) Source with Arguments" |
| 423 | 423 | |
| 424 | 424 | # Test 1: Source script with positional parameters |
| 425 | | - echo 'echo "arg1=$1 arg2=$2"' > /tmp/fortsh_test_source |
| 426 | | - output=$($SHELL_BIN -c '. /tmp/fortsh_test_source hello world' 2>&1) |
| 427 | | - rm -f /tmp/fortsh_test_source |
| 425 | + echo 'echo "arg1=$1 arg2=$2"' > /tmp/bensch_test_source |
| 426 | + output=$($SHELL_BIN -c '. /tmp/bensch_test_source hello world' 2>&1) |
| 427 | + rm -f /tmp/bensch_test_source |
| 428 | 428 | |
| 429 | 429 | if echo "$output" | grep -q "arg1=hello arg2=world"; then |
| 430 | 430 | pass "P2-2.1: dot command passes arguments to sourced script" |
@@ -433,9 +433,9 @@ test_p2_dot_with_args() { |
| 433 | 433 | fi |
| 434 | 434 | |
| 435 | 435 | # Test 2: Source script preserves caller's variables |
| 436 | | - echo 'SOURCED_VAR=from_script' > /tmp/fortsh_test_source2 |
| 437 | | - output=$($SHELL_BIN -c '. /tmp/fortsh_test_source2; echo $SOURCED_VAR' 2>&1) |
| 438 | | - rm -f /tmp/fortsh_test_source2 |
| 436 | + echo 'SOURCED_VAR=from_script' > /tmp/bensch_test_source2 |
| 437 | + output=$($SHELL_BIN -c '. /tmp/bensch_test_source2; echo $SOURCED_VAR' 2>&1) |
| 438 | + rm -f /tmp/bensch_test_source2 |
| 439 | 439 | |
| 440 | 440 | if echo "$output" | grep -q "from_script"; then |
| 441 | 441 | pass "P2-2.2: Sourced script sets variables in caller" |
@@ -444,9 +444,9 @@ test_p2_dot_with_args() { |
| 444 | 444 | fi |
| 445 | 445 | |
| 446 | 446 | # Test 3: Source with absolute path |
| 447 | | - echo 'echo sourced' > /tmp/fortsh_abs_source |
| 448 | | - output=$($SHELL_BIN -c '. /tmp/fortsh_abs_source' 2>&1) |
| 449 | | - rm -f /tmp/fortsh_abs_source |
| 447 | + echo 'echo sourced' > /tmp/bensch_abs_source |
| 448 | + output=$($SHELL_BIN -c '. /tmp/bensch_abs_source' 2>&1) |
| 449 | + rm -f /tmp/bensch_abs_source |
| 450 | 450 | |
| 451 | 451 | if echo "$output" | grep -q "sourced"; then |
| 452 | 452 | pass "P2-2.3: dot command works with absolute paths" |
@@ -596,7 +596,7 @@ main() { |
| 596 | 596 | echo "Date: $(date)" |
| 597 | 597 | echo "" |
| 598 | 598 | |
| 599 | | - # Verify fortsh exists |
| 599 | + # Verify shell binary exists |
| 600 | 600 | if [ ! -x "$SHELL_BIN" ]; then |
| 601 | 601 | echo -e "${RED}ERROR: shell binary not found or not executable: $SHELL_BIN${NC}" |
| 602 | 602 | echo "Please build fortsh or set SHELL_BIN environment variable" |