aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2018-09-15 15:55:47 +0530
committerArun Isaac2018-09-15 15:55:47 +0530
commita3f62b26c559bee108eb59dc3afe9bce5d4b46cd (patch)
treecf7afd2c340627cc7c120fa683ee1543f25b1f9f
parentd3ebe5a4920bf28c2c579078bb69e349776d5840 (diff)
downloadguile-email-a3f62b26c559bee108eb59dc3afe9bce5d4b46cd.tar.gz
guile-email-a3f62b26c559bee108eb59dc3afe9bce5d4b46cd.tar.lz
guile-email-a3f62b26c559bee108eb59dc3afe9bce5d4b46cd.zip
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.
-rwxr-xr-xtests/quoted-printable.scm13
1 files changed, 9 insertions, 4 deletions
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"