From 0ec29230d7e5b4706cdedc7a3c380e90e8313d73 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 12 Nov 2024 11:13:50 -0500 Subject: base64: Add tests for no padding cases. --- tests/base64.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'tests/base64.scm') 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)))) -- cgit v1.2.3