@@ -930,7 +930,8 @@ test_line_prefix() { |
| 930 | 930 | should_run "$name" && { |
| 931 | 931 | log_test "$name" |
| 932 | 932 | local out |
| 933 | | - out=$("$FERP" -n "line 1" "$FIXTURES/numbers.txt") |
| 933 | + # Use -x for exact line match to avoid "line 10" also matching |
| 934 | + out=$("$FERP" -nx "line 1" "$FIXTURES/numbers.txt") |
| 934 | 935 | if [[ "$out" == "1:line 1" ]]; then |
| 935 | 936 | pass "$name" |
| 936 | 937 | else |
@@ -955,7 +956,8 @@ test_line_prefix() { |
| 955 | 956 | should_run "$name" && { |
| 956 | 957 | log_test "$name" |
| 957 | 958 | local out |
| 958 | | - out=$("$FERP" -b "line 1" "$FIXTURES/numbers.txt") |
| 959 | + # Use -x for exact line match to avoid "line 10" also matching |
| 960 | + out=$("$FERP" -bx "line 1" "$FIXTURES/numbers.txt") |
| 959 | 961 | if [[ "$out" == "0:line 1" ]]; then |
| 960 | 962 | pass "$name" |
| 961 | 963 | else |
@@ -992,7 +994,8 @@ test_line_prefix() { |
| 992 | 994 | should_run "$name" && { |
| 993 | 995 | log_test "$name" |
| 994 | 996 | local out |
| 995 | | - out=$("$FERP" --byte-offset "line 1" "$FIXTURES/numbers.txt") |
| 997 | + # Use -x for exact line match |
| 998 | + out=$("$FERP" --byte-offset -x "line 1" "$FIXTURES/numbers.txt") |
| 996 | 999 | if [[ "$out" == "0:line 1" ]]; then |
| 997 | 1000 | pass "$name" |
| 998 | 1001 | else |
@@ -1055,7 +1058,8 @@ test_line_prefix() { |
| 1055 | 1058 | should_run "$name" && { |
| 1056 | 1059 | log_test "$name" |
| 1057 | 1060 | local out |
| 1058 | | - out=$("$FERP" -HZ "hello" "$FIXTURES/simple.txt" | head -1 | od -c | head -1) |
| 1061 | + # Check that null byte exists between filename and content |
| 1062 | + out=$("$FERP" -HZ "hello" "$FIXTURES/simple.txt" | head -1 | od -c) |
| 1059 | 1063 | if echo "$out" | grep -q '\\0'; then |
| 1060 | 1064 | pass "$name" |
| 1061 | 1065 | else |
@@ -1067,7 +1071,8 @@ test_line_prefix() { |
| 1067 | 1071 | should_run "$name" && { |
| 1068 | 1072 | log_test "$name" |
| 1069 | 1073 | local out |
| 1070 | | - out=$("$FERP" -H --null "hello" "$FIXTURES/simple.txt" | head -1 | od -c | head -1) |
| 1074 | + # Check that null byte exists between filename and content |
| 1075 | + out=$("$FERP" -H --null "hello" "$FIXTURES/simple.txt" | head -1 | od -c) |
| 1071 | 1076 | if echo "$out" | grep -q '\\0'; then |
| 1072 | 1077 | pass "$name" |
| 1073 | 1078 | else |