@@ -930,7 +930,8 @@ test_line_prefix() { |
| 930 | should_run "$name" && { | 930 | should_run "$name" && { |
| 931 | log_test "$name" | 931 | log_test "$name" |
| 932 | local out | 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 | if [[ "$out" == "1:line 1" ]]; then | 935 | if [[ "$out" == "1:line 1" ]]; then |
| 935 | pass "$name" | 936 | pass "$name" |
| 936 | else | 937 | else |
@@ -955,7 +956,8 @@ test_line_prefix() { |
| 955 | should_run "$name" && { | 956 | should_run "$name" && { |
| 956 | log_test "$name" | 957 | log_test "$name" |
| 957 | local out | 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 | if [[ "$out" == "0:line 1" ]]; then | 961 | if [[ "$out" == "0:line 1" ]]; then |
| 960 | pass "$name" | 962 | pass "$name" |
| 961 | else | 963 | else |
@@ -992,7 +994,8 @@ test_line_prefix() { |
| 992 | should_run "$name" && { | 994 | should_run "$name" && { |
| 993 | log_test "$name" | 995 | log_test "$name" |
| 994 | local out | 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 | if [[ "$out" == "0:line 1" ]]; then | 999 | if [[ "$out" == "0:line 1" ]]; then |
| 997 | pass "$name" | 1000 | pass "$name" |
| 998 | else | 1001 | else |
@@ -1055,7 +1058,8 @@ test_line_prefix() { |
| 1055 | should_run "$name" && { | 1058 | should_run "$name" && { |
| 1056 | log_test "$name" | 1059 | log_test "$name" |
| 1057 | local out | 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 | if echo "$out" | grep -q '\\0'; then | 1063 | if echo "$out" | grep -q '\\0'; then |
| 1060 | pass "$name" | 1064 | pass "$name" |
| 1061 | else | 1065 | else |
@@ -1067,7 +1071,8 @@ test_line_prefix() { |
| 1067 | should_run "$name" && { | 1071 | should_run "$name" && { |
| 1068 | log_test "$name" | 1072 | log_test "$name" |
| 1069 | local out | 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 | if echo "$out" | grep -q '\\0'; then | 1076 | if echo "$out" | grep -q '\\0'; then |
| 1072 | pass "$name" | 1077 | pass "$name" |
| 1073 | else | 1078 | else |