factor/basis/quoted-printable/quoted-printable-tests.factor

31 lines
1.1 KiB
Factor
Raw Normal View History

2009-01-28 13:29:25 -05:00
! Copyright (C) 2009 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
2009-09-20 23:42:40 -04:00
USING: tools.test quoted-printable io.encodings.string
2009-11-14 00:00:50 -05:00
sequences splitting kernel io.encodings.8-bit.latin2 ;
2009-01-28 13:29:25 -05:00
IN: quoted-printable.tests
{ "José was the
2009-01-28 13:29:25 -05:00
person who knew how to write the letters:
ő and ü
and we didn't know hów tö do thât" }
[ "Jos=E9 was the
2009-01-28 13:29:25 -05:00
person who knew how to write the letters:
=F5 and =FC=20
and w=
e didn't know h=F3w t=F6 do th=E2t" quoted> latin2 decode ] unit-test
2009-01-28 13:29:25 -05:00
{ "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" }
[ "José was the
2009-01-28 13:29:25 -05:00
person who knew how to write the letters:
ő and ü
and we didn't know hów tö do thât" latin2 encode >quoted ] unit-test
2009-01-28 13:29:25 -05:00
: message ( -- str )
55 [ "hello" ] replicate concat ;
{ f } [ message >quoted "=\r\n" swap subseq? ] unit-test
{ 1 } [ message >quoted string-lines length ] unit-test
{ t } [ message >quoted-lines "=\r\n" swap subseq? ] unit-test
{ 4 } [ message >quoted-lines string-lines length ] unit-test
{ "===o" } [ message >quoted-lines string-lines [ last ] "" map-as ] unit-test