-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add @base64d for decoding base64 jqlang#47
- Loading branch information
Shaun Guth
committed
Jan 26, 2016
1 parent
1740fd0
commit 9b08004
Showing
8 changed files
with
126 additions
and
5 deletions.
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
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
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,35 @@ | ||
# Tests are groups of three lines: program, input, expected output | ||
# Blank lines and lines starting with # are ignored | ||
|
||
@base64 | ||
"<>&'\"\t" | ||
"PD4mJyIJ" | ||
|
||
# decoding encoded output results in same text | ||
(@base64|@base64d) | ||
"<>&'\"\t" | ||
"<>&'\"\t" | ||
|
||
# regression test for #436 | ||
@base64 | ||
"foóbar\n" | ||
"Zm/Ds2Jhcgo=" | ||
|
||
@base64d | ||
"Zm/Ds2Jhcgo=" | ||
"foóbar\n" | ||
|
||
# optional trailing equals padding (With padding, this is cWl4YmF6Cg==) | ||
@base64d | ||
"cWl4YmF6Cg" | ||
"qixbaz\n" | ||
|
||
# invalid base64 characters (whitespace) | ||
. | try @base64d catch . | ||
"Not base64 data" | ||
"string (\"Not base64...) is not valid base64 data" | ||
|
||
# invalid base64 (too many bytes, QUJD = "ABCD" | ||
. | try @base64d catch . | ||
"QUJDa" | ||
"string (\"QUJDa\") trailing base64 byte found" |
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,5 @@ | ||
#!/bin/sh | ||
|
||
. "${0%/*}/setup" "$@" | ||
|
||
$VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/base64.test |
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