Skip to content

Commit

Permalink
[t] Convert most unicode:"" string literals to utf8:""
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@49513 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
nwellnhof committed Oct 11, 2010
1 parent 78eb90e commit ebc3c2c
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 93 deletions.
2 changes: 1 addition & 1 deletion src/string/encoding/shared.c
Expand Up @@ -1221,7 +1221,7 @@ unicode_upcase(PARROT_INTERP, ARGIN(const STRING *src))

/*
* XXX troubles:
* t/op/string_cs_45 upcase unicode:"\u01f0"
* t/op/string_cs_45 upcase utf8:"\u01f0"
* this creates \u004a \u030c J+NON-SPACING HACEK
* the string needs resizing, *if* the src buffer is
* too short. *But* with icu 3.2/3.4 the src string is
Expand Down
2 changes: 1 addition & 1 deletion t/compilers/imcc/syn/objects.t
Expand Up @@ -28,7 +28,7 @@
.namespace ["Foo"]
.namespace [ ]
.namespace []
.namespace [unicode:"»ö«"; ascii:"perl6"]
.namespace [utf8:"»ö«"; ascii:"perl6"]

.sub test
$I0 = 42
Expand Down
6 changes: 3 additions & 3 deletions t/compilers/imcc/syn/pcc.t
Expand Up @@ -545,13 +545,13 @@ pir_output_is( <<'CODE', <<'OUT', 'Unicode allowed in method names, TT #730' );
.sub 'main' :main
$P0 = newclass 'Foo'
$P1 = new $P0
$S0 = unicode:"foo\x{b1}"
$S0 = utf8:"foo\x{b1}"
$P1.$S0(1)
$P1.unicode:"foo\x{b1}"(2)
$P1.utf8:"foo\x{b1}"(2)
.end
.namespace ['Foo']
.sub unicode:"foo\x{b1}" :method
.sub utf8:"foo\x{b1}" :method
.param int count
print 'ok '
print count
Expand Down
8 changes: 4 additions & 4 deletions t/compilers/imcc/syn/regressions.t
Expand Up @@ -156,9 +156,9 @@ OUT
pir_output_is( <<'CODE', <<'OUT', 'unicode lexical identifiers (TT #575)');
.sub main :main
$P0 = box 'hello world'
.lex unicode:"$\u03b2\u03bf\u03bf", $P0
.lex utf8:"$\u03b2\u03bf\u03bf", $P0
$P1 = find_lex unicode:"$\u03b2\u03bf\u03bf"
$P1 = find_lex utf8:"$\u03b2\u03bf\u03bf"
say $P1
.end
CODE
Expand All @@ -167,12 +167,12 @@ OUT

pir_output_is( <<'CODE', <<'OUT', 'unicode named identifiers (TT #654)');
.sub 'main' :main
'foo'(1 :named(unicode:"\x{e4}"))
'foo'(1 :named(utf8:"\x{e4}"))
.end
# Perl 6: sub foo(:$ä) { say "ok $ä"; }
.sub 'foo'
.param int x :named(unicode:"\x{e4}")
.param int x :named(utf8:"\x{e4}")
print "ok "
say x
.end
Expand Down
4 changes: 2 additions & 2 deletions t/compilers/imcc/syn/subflags.t
Expand Up @@ -97,7 +97,7 @@ test flags on PIR subs
## unicode nsentry
.const 'Sub' $P60 = 'subid3'
isa_ok($P60, 'Sub', 'subid3 found w/.const')
$P0 = get_global unicode:"nsentry\u2462"
$P0 = get_global utf8:"nsentry\u2462"
$I0 = issame $P60, $P0
ok($I0, "nsentry3 found in namespace")

Expand Down Expand Up @@ -176,7 +176,7 @@ test flags on PIR subs
.end


.sub 'anon3' :nsentry(unicode:"nsentry\u2462") :subid('subid3')
.sub 'anon3' :nsentry(utf8:"nsentry\u2462") :subid('subid3')
.return ('anon3')
.end

Expand Down
4 changes: 2 additions & 2 deletions t/library/string_utils.t
Expand Up @@ -68,8 +68,8 @@ Tests for String/Utils.pbc
test_radix_digits('[41,42]XYZ', 'x', 0, 'AB', 7, '\x[41,42]')
test_radix_digits('[41,42]' , 'x', 1, 'A' , 2, '\x41')
test_radix_digits('[41,42]' , 'x', 4, 'B', 2, '\x42')
test_radix_digits('2000' , 'x', 0, unicode:"\u2000", 4, '\x2000')
test_radix_digits('1680' , 'x', 0, unicode:"\u1680", 4, '\x1680')
test_radix_digits('2000' , 'x', 0, utf8:"\u2000", 4, '\x2000')
test_radix_digits('1680' , 'x', 0, utf8:"\u1680", 4, '\x1680')
.end


Expand Down
12 changes: 6 additions & 6 deletions t/op/string.t
Expand Up @@ -875,15 +875,15 @@ WHILE:

# Ascii - Non-ascii, same content
set $S0, "hello"
set $S1, unicode:"hello"
set $S1, utf8:"hello"
index $I1, $S0, $S1
is( $I1, "0", 'index, 3-arg form' )
index $I1, $S1, $S0
is( $I1, "0", 'index, 3-arg form' )

# Non-ascii, source shorter than searched
set $S0, unicode:"-o"
set $S1, unicode:"@INC"
set $S0, utf8:"-o"
set $S1, utf8:"@INC"
index $I1, $S0, $S1
is( $I1, "-1", 'index, 3-arg form' )
.end
Expand All @@ -903,7 +903,7 @@ WHILE:

# Ascii - Non-ascii, same content
set $S0, "hello"
set $S1, unicode:"hello"
set $S1, utf8:"hello"
index $I1, $S0, $S1, 0
is( $I1, "0", 'index, 4-arg form' )
index $I1, $S1, $S0, 0
Expand All @@ -922,8 +922,8 @@ WHILE:
.end

.sub index_trac_1482
$S0 = unicode:"bubuc"
$S1 = unicode:"buc"
$S0 = utf8:"bubuc"
$S1 = utf8:"buc"

$I0 = index $S0, $S1, 0
is ($I0, 2, 'index, 4-arg, partial-match causes failure: TT #1482')
Expand Down
10 changes: 5 additions & 5 deletions t/op/string_cclass.t
Expand Up @@ -309,7 +309,7 @@ push @{ $ws->{whitespace} } => @{ $ws->{whitespace_ascii} },

sub string {
my $which = shift;
'unicode:"' . join( '', @{ $ws->{$which} } ) . '"';
'utf8:"' . join( '', @{ $ws->{$which} } ) . '"';
}

my $all_ws = string('whitespace');
Expand Down Expand Up @@ -350,7 +350,7 @@ OUT
.local int result, char, len, i
.local string s
s = $all_ws
s = unicode:"abc" . s
s = utf8:"abc" . s
len = length s
result = find_cclass .CCLASS_WHITESPACE, s, 0, len
print result
Expand All @@ -366,7 +366,7 @@ OUT
.local int result, char, len, i
.local string s
s = $all_ws
s .= unicode:"abc"
s .= utf8:"abc"
len = length s
result = find_not_cclass .CCLASS_WHITESPACE, s, 0, len
print len
Expand All @@ -385,7 +385,7 @@ pir_output_is( <<"CODE", <<'OUT', "unicode 0-127 find_*_cclass whitespace" );
.include "cclass.pasm"
.local int result, char, len, i
.local string s
s = unicode:"abc def"
s = utf8:"abc def"
len = length s
result = find_cclass .CCLASS_WHITESPACE, s, 0, len
print len
Expand All @@ -403,7 +403,7 @@ OUT
pir_output_is( <<'CODE', <<'OUT', "is_cclass, unicode first codepage" );
.include "cclass.pasm"
.sub main :main
$S1 = unicode:"ab\nC_X34.\0 \t!"
$S1 = utf8:"ab\nC_X34.\0 \t!"
test1( $S1 )
.end
.sub test1
Expand Down
2 changes: 0 additions & 2 deletions t/op/string_cs.t
Expand Up @@ -473,7 +473,6 @@ SKIP: {
CODE
hello(5): ascii
hello(5): utf8
hello(5): utf8
hello(10): utf16
hello(10): ucs2
OUTPUT
Expand Down Expand Up @@ -506,7 +505,6 @@ OUTPUT
CODE
(0): ascii
(0): utf8
(0): utf8
(0): utf16
(0): ucs2
OUTPUT
Expand Down

0 comments on commit ebc3c2c

Please sign in to comment.