ignore extra tokens on line - broken

This commit is contained in:
Paul Campbell 2022-01-14 08:01:59 +00:00
parent 96832abac6
commit a90d17bb97
2 changed files with 7 additions and 3 deletions

View file

@ -153,8 +153,12 @@ fn dumpInput(config: Config, in: fs.File, out: fs.File, allocator: mem.Allocator
} else {
if (config.token) |token| {
if (line) |memory| {
if (config.ignoreExtras) {
c += 1;
} else {
c += mem.count(u8, memory, token);
}
}
} else {
c += 1;
}

View file

@ -88,7 +88,7 @@ diff --brief test.expect.err test.err
rm test.expect test.out
rm test.expect.err test.err
echo "> skip lines until 3 tokens seen - ignored extra tokens on same line"
echo "> skip lines until 4 tokens seen - ignored extra tokens on same line"
cat<<EOF > test.in
Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
@ -104,7 +104,7 @@ quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea
commodo consequat.
EOF
./skip 3 test.in --token m --ignore-extras > test.out
./skip 4 test.in --token m --ignore-extras > test.out
diff --brief test.expect test.out
rm test.in test.expect test.out