[svn:parrot] r47945 - branches/gsoc_nfg/t/op
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Wed Jun 30 23:51:20 UTC 2010
Author: darbelo
Date: Wed Jun 30 23:51:20 2010
New Revision: 47945
URL: https://trac.parrot.org/parrot/changeset/47945
Log:
Add freeze/thaw tests.
Modified:
branches/gsoc_nfg/t/op/string_nfg.t
Modified: branches/gsoc_nfg/t/op/string_nfg.t
==============================================================================
--- branches/gsoc_nfg/t/op/string_nfg.t Wed Jun 30 23:51:08 2010 (r47944)
+++ branches/gsoc_nfg/t/op/string_nfg.t Wed Jun 30 23:51:20 2010 (r47945)
@@ -20,7 +20,7 @@
.include 'stringinfo.pasm'
-.const int TESTS = 10
+.const int TESTS = 14
.sub _main :main
.include 'test_more.pir'
@@ -30,6 +30,7 @@
literals_and_transcoding()
transcode_without_graphemes()
transcode_with_graphemes()
+ freeze_and_thaw()
.end
.sub literals_and_transcoding
@@ -101,6 +102,35 @@
.end
+.sub freeze_and_thaw
+
+ $S0 = nfg:unicode:"\u006e\u0303\u0303\u0303\u0303\u00d1\u00d1"
+
+ $P0 = new ['String']
+ $P0 = $S0
+
+ $S1 = freeze $P0
+ $P1 = thaw $S1
+
+ $S2 = $P1
+
+ $I0 = encoding $S0
+ $I1 = encoding $S2
+ is($I0, $I1, "Encoding is preserved.")
+
+ $I0 = encoding $S0
+ $I1 = encoding $S2
+ is($I0, $I1, "Encoding is preserved.")
+
+ $I0 = stringinfo $S0, .STRINGINFO_STRLEN
+ $I1 = stringinfo $S2, .STRINGINFO_STRLEN
+ is($I0, $I1, "Length is preserved.")
+
+ $I1 = stringinfo $S2, .STRINGINFO_EXTRA
+ isnt(0, $I1, "Graphemes are preserved.")
+
+.end
+
# Local Variables:
# mode: pir
# fill-column: 100
More information about the parrot-commits
mailing list