diff options
| author | Andrei Zmievski <andrei@php.net> | 2005-08-11 23:36:07 +0000 |
|---|---|---|
| committer | Andrei Zmievski <andrei@php.net> | 2005-08-11 23:36:07 +0000 |
| commit | 264cec8be641d1c2ea0c95d915d506c4fdbc751a (patch) | |
| tree | e9f980e16f707842248125cf22efabec782cfece /tests | |
| parent | b80cb7bd2f721dad13a97a1300c6dc56934daaf7 (diff) | |
| download | php-git-264cec8be641d1c2ea0c95d915d506c4fdbc751a.tar.gz | |
Unicode support.
Diffstat (limited to 'tests')
32 files changed, 374 insertions, 0 deletions
diff --git a/tests/unicode/autodetect-SCSU.inc b/tests/unicode/autodetect-SCSU.inc new file mode 100644 index 0000000000..d905c6c497 --- /dev/null +++ b/tests/unicode/autodetect-SCSU.inc @@ -0,0 +1,7 @@ +<?php +function µ() { + echo "µ - ok\n"; +} + +µ(); +?> diff --git a/tests/unicode/autodetect-SCSU.phpt b/tests/unicode/autodetect-SCSU.phpt new file mode 100755 index 0000000000..a3e3f45c0a --- /dev/null +++ b/tests/unicode/autodetect-SCSU.phpt @@ -0,0 +1,11 @@ +--TEST-- +Script encoding autodetection (SCSU) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +include(dirname(__FILE__)."/autodetect-SCSU.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/autodetect-UTF16BE.inc b/tests/unicode/autodetect-UTF16BE.inc Binary files differnew file mode 100644 index 0000000000..5e808dd60b --- /dev/null +++ b/tests/unicode/autodetect-UTF16BE.inc diff --git a/tests/unicode/autodetect-UTF16BE.phpt b/tests/unicode/autodetect-UTF16BE.phpt new file mode 100755 index 0000000000..439276961d --- /dev/null +++ b/tests/unicode/autodetect-UTF16BE.phpt @@ -0,0 +1,11 @@ +--TEST-- +Script encoding autodetection (UTF-16BE) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +include(dirname(__FILE__)."/autodetect-UTF16BE.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/autodetect-UTF16LE.inc b/tests/unicode/autodetect-UTF16LE.inc Binary files differnew file mode 100644 index 0000000000..666a4856ea --- /dev/null +++ b/tests/unicode/autodetect-UTF16LE.inc diff --git a/tests/unicode/autodetect-UTF16LE.phpt b/tests/unicode/autodetect-UTF16LE.phpt new file mode 100755 index 0000000000..4daaf7cad7 --- /dev/null +++ b/tests/unicode/autodetect-UTF16LE.phpt @@ -0,0 +1,11 @@ +--TEST-- +Script encoding autodetection (UTF-16LE) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +include(dirname(__FILE__)."/autodetect-UTF16LE.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/autodetect-UTF32BE.inc b/tests/unicode/autodetect-UTF32BE.inc Binary files differnew file mode 100755 index 0000000000..1f26885771 --- /dev/null +++ b/tests/unicode/autodetect-UTF32BE.inc diff --git a/tests/unicode/autodetect-UTF32BE.phpt b/tests/unicode/autodetect-UTF32BE.phpt new file mode 100755 index 0000000000..39e62b5445 --- /dev/null +++ b/tests/unicode/autodetect-UTF32BE.phpt @@ -0,0 +1,11 @@ +--TEST-- +Script encoding autodetection (UTF-32BE) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +include(dirname(__FILE__)."/autodetect-UTF32BE.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/autodetect-UTF32LE.inc b/tests/unicode/autodetect-UTF32LE.inc Binary files differnew file mode 100755 index 0000000000..5bf6a1d286 --- /dev/null +++ b/tests/unicode/autodetect-UTF32LE.inc diff --git a/tests/unicode/autodetect-UTF32LE.phpt b/tests/unicode/autodetect-UTF32LE.phpt new file mode 100755 index 0000000000..b966b04b2a --- /dev/null +++ b/tests/unicode/autodetect-UTF32LE.phpt @@ -0,0 +1,11 @@ +--TEST-- +Script encoding autodetection (UTF-32LE) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +include(dirname(__FILE__)."/autodetect-UTF32LE.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/autodetect-UTF7.inc b/tests/unicode/autodetect-UTF7.inc new file mode 100644 index 0000000000..dc2bda486c --- /dev/null +++ b/tests/unicode/autodetect-UTF7.inc @@ -0,0 +1,7 @@ ++/v8<?php +function +BEIENQRBBEI() { + echo "+BEIENQRBBEI - ok+AFw-n"; +} + ++BEIENQRBBEI(); +?> diff --git a/tests/unicode/autodetect-UTF7.phpt b/tests/unicode/autodetect-UTF7.phpt new file mode 100755 index 0000000000..89f8e6d305 --- /dev/null +++ b/tests/unicode/autodetect-UTF7.phpt @@ -0,0 +1,11 @@ +--TEST-- +Script encoding autodetection (UTF7) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +include(dirname(__FILE__)."/autodetect-UTF7.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/autodetect-UTF8.inc b/tests/unicode/autodetect-UTF8.inc new file mode 100755 index 0000000000..e6af829d4c --- /dev/null +++ b/tests/unicode/autodetect-UTF8.inc @@ -0,0 +1,7 @@ +<?php +function тест() { + echo "тест - ok\n"; +} + +тест(); +?> diff --git a/tests/unicode/autodetect-UTF8.phpt b/tests/unicode/autodetect-UTF8.phpt new file mode 100755 index 0000000000..570f398b2b --- /dev/null +++ b/tests/unicode/autodetect-UTF8.phpt @@ -0,0 +1,11 @@ +--TEST-- +Script encoding autodetection (UTF8) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +include(dirname(__FILE__)."/autodetect-UTF8.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/enc-HZ.inc b/tests/unicode/enc-HZ.inc new file mode 100644 index 0000000000..ac38662dde --- /dev/null +++ b/tests/unicode/enc-HZ.inc @@ -0,0 +1,7 @@ +~}<?php +function ~{'d'V'c'd~}() { + echo "~{'d'V'c'd~} - ok\n"; +} + +~{'d'V'c'd~}(); +?> diff --git a/tests/unicode/enc-HZ.phpt b/tests/unicode/enc-HZ.phpt new file mode 100755 index 0000000000..9b327a1ee8 --- /dev/null +++ b/tests/unicode/enc-HZ.phpt @@ -0,0 +1,12 @@ +--TEST-- +Script encoding (HZ) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +ini_set("unicode.script_encoding", "HZ"); +include(dirname(__FILE__)."/enc-HZ.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/enc-ISO-2022-KR.inc b/tests/unicode/enc-ISO-2022-KR.inc new file mode 100644 index 0000000000..fca3ab842c --- /dev/null +++ b/tests/unicode/enc-ISO-2022-KR.inc @@ -0,0 +1,7 @@ +$)C<?php +function ,d,V,c,d() { + echo ",d,V,c,d - okn"; +} + +,d,V,c,d(); +?> diff --git a/tests/unicode/enc-ISO-2022-KR.phpt b/tests/unicode/enc-ISO-2022-KR.phpt new file mode 100755 index 0000000000..94033f624e --- /dev/null +++ b/tests/unicode/enc-ISO-2022-KR.phpt @@ -0,0 +1,12 @@ +--TEST-- +Script encoding (ISO-2022-KR) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +ini_set("unicode.script_encoding", "ISO-2022-KR"); +include(dirname(__FILE__)."/enc-ISO-2022-KR.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/enc-JIS.inc b/tests/unicode/enc-JIS.inc new file mode 100644 index 0000000000..00d3ae690b --- /dev/null +++ b/tests/unicode/enc-JIS.inc @@ -0,0 +1,7 @@ +<?php +function $B'd'V'c'd(B() { + echo "$B'd'V'c'd(B - ok\n"; +} + +$B'd'V'c'd(B(); +?> diff --git a/tests/unicode/enc-JIS.phpt b/tests/unicode/enc-JIS.phpt new file mode 100755 index 0000000000..4bab19841a --- /dev/null +++ b/tests/unicode/enc-JIS.phpt @@ -0,0 +1,12 @@ +--TEST-- +Script encoding (JIS) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +ini_set("unicode.script_encoding", "JIS"); +include(dirname(__FILE__)."/enc-JIS.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/enc-SJIS.inc b/tests/unicode/enc-SJIS.inc new file mode 100644 index 0000000000..12e799306a --- /dev/null +++ b/tests/unicode/enc-SJIS.inc @@ -0,0 +1,7 @@ +<?php +function u() { + echo "u - ok\n"; +} + +u(); +?> diff --git a/tests/unicode/enc-SJIS.phpt b/tests/unicode/enc-SJIS.phpt new file mode 100755 index 0000000000..bd190ee86a --- /dev/null +++ b/tests/unicode/enc-SJIS.phpt @@ -0,0 +1,12 @@ +--TEST-- +Script encoding (SJIS) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +ini_set("unicode.script_encoding", "SJIS"); +include(dirname(__FILE__)."/enc-SJIS.inc"); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/encrt-HZ.phpt b/tests/unicode/encrt-HZ.phpt new file mode 100755 index 0000000000..c0f3812361 --- /dev/null +++ b/tests/unicode/encrt-HZ.phpt @@ -0,0 +1,17 @@ +--TEST-- +declare script encoding (HZ) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +declare(encoding="HZ"); + +function ~{'d'V'c'd~}() { + echo "~{'d'V'c'd~} - ok\n"; +} + +~{'d'V'c'd~}(); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/encrt-ISO-2022-KR.phpt b/tests/unicode/encrt-ISO-2022-KR.phpt new file mode 100755 index 0000000000..ebca20231a --- /dev/null +++ b/tests/unicode/encrt-ISO-2022-KR.phpt @@ -0,0 +1,17 @@ +--TEST-- +declare script encoding (ISO-2022-KR) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +declare(encoding="ISO-2022-KR"); + +function ,d,V,c,d() { + echo ",d,V,c,d - okn"; +} + +,d,V,c,d(); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/encrt-JIS.phpt b/tests/unicode/encrt-JIS.phpt new file mode 100755 index 0000000000..082c1caf18 --- /dev/null +++ b/tests/unicode/encrt-JIS.phpt @@ -0,0 +1,17 @@ +--TEST-- +declare script encoding (JIS) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +declare(encoding="JIS"); + +function $B'd'V'c'd(B() { + echo "$B'd'V'c'd(B - ok\n"; +} + +$B'd'V'c'd(B(); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/encrt-SJIS.phpt b/tests/unicode/encrt-SJIS.phpt new file mode 100755 index 0000000000..918ddc910e --- /dev/null +++ b/tests/unicode/encrt-SJIS.phpt @@ -0,0 +1,17 @@ +--TEST-- +declare script encoding (SJIS) +--INI-- +unicode_semantics=on +unicode.output_encoding=CP866 +--FILE-- +<?php +declare(encoding="SJIS"); + +function u() { + echo "u - ok\n"; +} + +u(); +?> +--EXPECT-- + - ok diff --git a/tests/unicode/func/strpos.phpt b/tests/unicode/func/strpos.phpt new file mode 100644 index 0000000000..9bef742e97 --- /dev/null +++ b/tests/unicode/func/strpos.phpt @@ -0,0 +1,40 @@ +--TEST-- +Unicode: strpos() function test +--FILE-- +<?php +$a = "a™ᄒ\U020021z"; +var_dump(strpos($a, 'a')); +var_dump(strpos($a, 'U')); +var_dump(strpos($a, 'z')); +var_dump(strpos($a, '\u2122')); +var_dump(strpos($a, 0x1112)); +var_dump(strpos($a, 0x20021)); + +$b = "\U020022z\U020021z"; +var_dump(strpos($b, 'z', 1)); +var_dump(strpos($b, 'z', 2)); +var_dump(strpos($b, 'z', 4)); +var_dump(strpos($b, 'z\U020021')); + +$c = "-A\u030a-Å-Å"; +var_dump(strpos($c, 'A')); +var_dump(strpos($c, '\u030a')); +var_dump(strpos($c, '\u00c5')); +var_dump(strpos($c, '\u212b')); + +?> +--EXPECT-- +int(0) +bool(false) +int(4) +int(1) +int(2) +int(3) +int(1) +int(3) +bool(false) +int(1) +int(1) +int(2) +int(4) +int(6) diff --git a/tests/unicode/func/strstr.phpt b/tests/unicode/func/strstr.phpt new file mode 100644 index 0000000000..ad5727dada --- /dev/null +++ b/tests/unicode/func/strstr.phpt @@ -0,0 +1,37 @@ +--TEST-- +Unicode: strpos() function test +--FILE-- +<?php +$a = "a™ᄒ\U020021z"; +var_dump(strstr($a, 'a')); +var_dump(strstr($a, 'U')); +var_dump(strstr($a, 'z')); +var_dump(strstr($a, '\u2122')); +var_dump(strstr($a, '\udc21')); +var_dump(strstr($a, 0x1112)); +var_dump(strstr($a, 0x20021)); + +$b = "\U020022z\U020021z"; +var_dump(strstr($b, '\U020021')); +var_dump(strstr($b, 'z\U020021')); + +$c = "-A\u030a-Å-Å"; +var_dump(strstr($c, 'A')); +var_dump(strstr($c, '\u030a')); +var_dump(strstr($c, '\u00c5')); +var_dump(strstr($c, '\u212b')); +?> +--EXPECT-- +unicode(5) "a™ᄒ𠀡z" +bool(false) +unicode(1) "z" +unicode(4) "™ᄒ𠀡z" +bool(false) +unicode(3) "ᄒ𠀡z" +unicode(2) "𠀡z" +unicode(2) "𠀡z" +unicode(3) "z𠀡z" +unicode(6) "Å-Å-Å" +unicode(5) "̊-Å-Å" +unicode(3) "Å-Å" +unicode(1) "Å" diff --git a/tests/unicode/normalize_001.phpt b/tests/unicode/normalize_001.phpt new file mode 100755 index 0000000000..46b456fc4e --- /dev/null +++ b/tests/unicode/normalize_001.phpt @@ -0,0 +1,11 @@ +--TEST-- +Unicode identifiers normalization (${}) +--INI-- +unicode_semantics=on +--FILE-- +<?php +${"\u212B"} = "ok\n"; +echo ${"\u00C5"}; +?> +--EXPECT-- +ok diff --git a/tests/unicode/normalize_002.phpt b/tests/unicode/normalize_002.phpt new file mode 100755 index 0000000000..ade41ec5fe --- /dev/null +++ b/tests/unicode/normalize_002.phpt @@ -0,0 +1,13 @@ +--TEST-- +Unicode identifiers normalization ($$) +--INI-- +unicode_semantics=on +--FILE-- +<?php +$a = "\u212B"; +$b = "\u00C5"; +$$a = "ok\n"; +echo $$b; +?> +--EXPECT-- +ok diff --git a/tests/unicode/normalize_003.phpt b/tests/unicode/normalize_003.phpt new file mode 100755 index 0000000000..21085acc24 --- /dev/null +++ b/tests/unicode/normalize_003.phpt @@ -0,0 +1,20 @@ +--TEST-- +Unicode identifiers normalization (indirect function call) +--INI-- +unicode_semantics=on +--FILE-- +<?php +declare(encoding = "ISO-8859-1"); + +function () { + echo "ok\n"; +} + +$f1 = "\u212B"; +$f1(); +$f2 = "\u00C5"; +$f2(); +?> +--EXPECT-- +ok +ok diff --git a/tests/unicode/normalize_004.phpt b/tests/unicode/normalize_004.phpt new file mode 100755 index 0000000000..37f65ee940 --- /dev/null +++ b/tests/unicode/normalize_004.phpt @@ -0,0 +1,11 @@ +--TEST-- +Unicode identifiers normalization ($GLOBALS[]) +--INI-- +unicode_semantics=on +--FILE-- +<?php +$GLOBALS["\u212B"] = "ok\n"; +echo $GLOBALS["\u00C5"]; +?> +--EXPECT-- +ok |
