-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testament: support
\0
byte in output comparison (#1083)
## Summary Neither the program output nor the comparison string are cut off at the first null byte anymore. ## Details Output comparisons in testament used `strutils.contains`, which uses `strutils.find`, which, by default, uses `c_strstr`. `c_strstr` operates on null-terminated strings, and thus stopped at the first occurrence of one, even if the end of the NimSkull string hasn't been reached yet. Testament now uses a custom `contains` implementation based on C's `memcmp`, so that the `\0` byte doesn't terminate the search.
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
discard """ | ||
output: "a\0b" | ||
""" | ||
|
||
# the string differ after the NULL byte | ||
echo "a\0c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters