mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
basenc: Fix basenc.pl GNU-compat tests pass (#9203)
* fix(basenc): align base32 decode with GNU * Add GNU-style basenc base32 tests * Expand basenc base32 tests and simplify failures Adds the GNU-style auto-padding/truncated cases to tests/by-util/test_basenc.rs and rewrites the failure assertions to use the chained fails().stdout_*(…).stderr_is(…) style for clarity. * Restore GNU expectations for b32h_5 and b32h_6 Updates util/build-gnu.sh to stop forcing those two basenc tests to expect empty stdout, so the GNU suite again checks for the leaked five bytes before failure. * Allow base32 decoder to auto-pad truncated blocks Introduce PadResult, trim/pad incomplete base32 chunks, emit decoded prefixes, and still return error: invalid input in line with GNU basenc.
This commit is contained in:
+1
-1
@@ -268,7 +268,7 @@ sed -i -e "s|invalid suffix in --pages argument|invalid --pages argument|" \
|
||||
# When decoding an invalid base32/64 string, gnu writes everything it was able to decode until
|
||||
# it hit the decode error, while we don't write anything if the input is invalid.
|
||||
sed -i "s/\(baddecode.*OUT=>\"\).*\"/\1\"/g" tests/basenc/base64.pl
|
||||
sed -i "s/\(\(b2[ml]_[69]\|b32h_[56]\|z85_8\|z85_35\).*OUT=>\)[^}]*\(.*\)/\1\"\"\3/g" tests/basenc/basenc.pl
|
||||
sed -i "s/\(\(b2[ml]_[69]\|z85_8\|z85_35\).*OUT=>\)[^}]*\(.*\)/\1\"\"\3/g" tests/basenc/basenc.pl
|
||||
|
||||
# add "error: " to the expected error message
|
||||
sed -i "s/\$prog: invalid input/\$prog: error: invalid input/g" tests/basenc/basenc.pl
|
||||
|
||||
Reference in New Issue
Block a user