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,8 +153,12 @@ fn dumpInput(config: Config, in: fs.File, out: fs.File, allocator: mem.Allocator
|
||||||
} else {
|
} else {
|
||||||
if (config.token) |token| {
|
if (config.token) |token| {
|
||||||
if (line) |memory| {
|
if (line) |memory| {
|
||||||
|
if (config.ignoreExtras) {
|
||||||
|
c += 1;
|
||||||
|
} else {
|
||||||
c += mem.count(u8, memory, token);
|
c += mem.count(u8, memory, token);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
c += 1;
|
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 test.out
|
||||||
rm test.expect.err test.err
|
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
|
cat<<EOF > test.in
|
||||||
Lorem ipsum dolor sit amet,
|
Lorem ipsum dolor sit amet,
|
||||||
consectetur adipiscing elit,
|
consectetur adipiscing elit,
|
||||||
|
@ -104,7 +104,7 @@ quis nostrud exercitation ullamco
|
||||||
laboris nisi ut aliquip ex ea
|
laboris nisi ut aliquip ex ea
|
||||||
commodo consequat.
|
commodo consequat.
|
||||||
EOF
|
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
|
diff --brief test.expect test.out
|
||||||
rm test.in test.expect test.out
|
rm test.in test.expect test.out
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue