summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/base64.scm17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/base64.scm b/tests/base64.scm
index c6ebe8f..2850471 100644
--- a/tests/base64.scm
+++ b/tests/base64.scm
@@ -30,9 +30,15 @@
(test-equal "one byte of padding"
"hello"
(utf8->string (base64-decode "aGVsbG8=")))
+ (test-equal "one byte of padding but no padding char"
+ "hello"
+ (utf8->string (base64-decode "aGVsbG8" #:padding? #f)))
(test-equal "two bytes of padding"
"what's up?"
- (utf8->string (base64-decode "d2hhdCdzIHVwPw=="))))
+ (utf8->string (base64-decode "d2hhdCdzIHVwPw==")))
+ (test-equal "two bytes of padding but no padding chars"
+ "what's up?"
+ (utf8->string (base64-decode "d2hhdCdzIHVwPw" #:padding? #f))))
(test-group "base64-encode"
(test-equal "empty string"
""
@@ -43,6 +49,9 @@
(test-equal "one byte of padding"
"aGVsbG8="
(base64-encode (string->utf8 "hello")))
- (test-equal "two bytes of padding"
- "d2hhdCdzIHVwPw=="
- (base64-encode (string->utf8 "what's up?")))))
+ (test-equal "one byte of padding but no padding char"
+ "aGVsbG8"
+ (base64-encode (string->utf8 "hello") #:padding? #f))
+ (test-equal "two bytes of padding but no padding chars"
+ "d2hhdCdzIHVwPw"
+ (base64-encode (string->utf8 "what's up?") #:padding? #f))))