[svn:parrot] r37852 - branches/p6strings/t/pmc

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Wed Apr 1 19:44:36 UTC 2009


Author: pmichaud
Date: Wed Apr  1 19:44:35 2009
New Revision: 37852
URL: https://trac.parrot.org/parrot/changeset/37852

Log:
[codestring]:  Tests for the charname_to_ord method in CodeString.

Modified:
   branches/p6strings/t/pmc/codestring.t

Modified: branches/p6strings/t/pmc/codestring.t
==============================================================================
--- branches/p6strings/t/pmc/codestring.t	Wed Apr  1 19:34:04 2009	(r37851)
+++ branches/p6strings/t/pmc/codestring.t	Wed Apr  1 19:44:35 2009	(r37852)
@@ -19,7 +19,7 @@
 
 .sub main :main
     .include 'include/test_more.pir'
-    plan(20)
+    plan(24)
 
     create_codestring()
     calls_to_unique()
@@ -31,6 +31,7 @@
     output_global_unique_num()
     namespace_keys()
     first_char_repl_regression()
+    ord_from_name()
 .end
 
 .sub create_codestring
@@ -167,6 +168,27 @@
     is(code, "new\n", "regression on first char repl bug looks fine")
 .end
 
+.sub 'ord_from_name'
+    .local pmc code
+    load_bytecode 'config.pbc'
+    $P0 = _config()
+    $I0 = $P0['has_icu']
+    if $I0 goto has_icu
+    skip(3, 'ICU unavailable')
+    .return ()
+    
+  has_icu:
+    code = new ['CodeString']
+    $I0 = code.'charname_to_ord'('LATIN CAPITAL LETTER C')
+    is($I0, 0x0043, "LATIN CAPITAL LETTER C")
+    $I0 = code.'charname_to_ord'('MUSIC FLAT SIGN')
+    is($I0, 0x266d, "MUSIC FLAT SIGN")
+    $I0 = code.'charname_to_ord'('RECYCLING SYMBOL FOR TYPE-1 PLASTICS')
+    is($I0, 0x2673, "RECYCLING SYMBOL FOR TYPE-1 PLASTICS")
+    $I0 = code.'charname_to_ord'('<no such symbol>')
+    is($I0, -1, '<no such symbol>')
+.end
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100


More information about the parrot-commits mailing list