ignore extra tokens on line - broken
This commit is contained in:
parent
96832abac6
commit
a90d17bb97
2 changed files with 7 additions and 3 deletions
|
@ -153,7 +153,11 @@ fn dumpInput(config: Config, in: fs.File, out: fs.File, allocator: mem.Allocator
|
|||
} else {
|
||||
if (config.token) |token| {
|
||||
if (line) |memory| {
|
||||
c += mem.count(u8, memory, token);
|
||||
if (config.ignoreExtras) {
|
||||
c += 1;
|
||||
} else {
|
||||
c += mem.count(u8, memory, token);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
c += 1;
|
||||
|
|
4
test.sh
4
test.sh
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue