]> gitweb.factorcode.org Git - factor.git/blob - basis/quoted-printable/quoted-printable-tests.factor
049d2b326b56dab64759633ce623ab4c3a9b32f2
[factor.git] / basis / quoted-printable / quoted-printable-tests.factor
1 ! Copyright (C) 2009 Daniel Ehrenberg
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: tools.test quoted-printable io.encodings.string
4 sequences splitting kernel io.encodings.8-bit ;
5 IN: quoted-printable.tests
6
7 { "José was the
8 person who knew how to write the letters:
9     ő and ü 
10 and we didn't know hów tö do thât" }
11 [ "Jos=E9 was the
12 person who knew how to write the letters:
13     =F5 and =FC=20
14 and w=
15 e didn't know h=F3w t=F6 do th=E2t" quoted> latin2 decode ] unit-test
16
17 { "Jos=E9 was the=0Aperson who knew how to write the letters:=0A    =F5 and =FC=0Aand we didn't know h=F3w t=F6 do th=E2t" }
18 [ "José was the
19 person who knew how to write the letters:
20     ő and ü
21 and we didn't know hów tö do thât" latin2 encode >quoted ] unit-test
22
23 : message ( -- str )
24     55 [ "hello" ] replicate concat ;
25
26 { f } [ message >quoted "=\r\n" subseq-index? ] unit-test
27 { 1 } [ message >quoted split-lines length ] unit-test
28 { t } [ message >quoted-lines "=\r\n" subseq-index? ] unit-test
29 { 4 } [ message >quoted-lines split-lines length ] unit-test
30 { "===o" } [ message >quoted-lines split-lines [ last ] "" map-as ] unit-test