From a3f62b26c559bee108eb59dc3afe9bce5d4b46cd Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 15 Sep 2018 15:55:47 +0530 Subject: tests: Extend quoted-printable special characters encoding test. * tests/quoted-printable.scm (quoted-printable-escape-encode-char): New function. ("quoted-printable encoding of ="): Rename to ... ("quoted-printable encoding of special characters"): ... this. Extend to test encoding of #\return and #\newline as well. --- tests/quoted-printable.scm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/quoted-printable.scm b/tests/quoted-printable.scm index e41eced..334380d 100755 --- a/tests/quoted-printable.scm +++ b/tests/quoted-printable.scm @@ -41,6 +41,9 @@ (ucs-range->char-set 33 127)) str)) +(define (quoted-printable-escape-encode-char chr) + (format #f "=~:@(~2,'0x~)" (char->integer chr))) + (test-begin "quoted-printable") (let ((decoded-text @@ -66,11 +69,13 @@ abriquent pour te la vendre une =C3=A2me vulgaire.") (quoted-printable-encode (string->bytevector decoded-text charset))))) -(test-equal "quoted-printable encoding of =" +(test-equal "quoted-printable encoding of special characters" (quoted-printable-encode - (string->bytevector "=" "UTF-8")) - (string-append "=" (string-upcase (number->string - (char->integer #\=) 16)))) + (string->bytevector "=\r\n" "UTF-8")) + (string-append + (quoted-printable-escape-encode-char #\=) + (quoted-printable-escape-encode-char #\return) + (quoted-printable-escape-encode-char #\newline))) (let ((x (random-bytevector 1000))) (test-equal "quoted-printable random bytevector: quoted-printable-encode and quoted-printable-decode are inverses of each other" -- cgit v1.2.3