Skip to content

Commit ae71bfd

Browse files
committed
Add more tests for UCS-4 text conversion
1 parent fd0e0c7 commit ae71bfd

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

ext/mbstring/tests/other_encodings.phpt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ echo "7bit done\n";
2020
var_dump(mb_convert_encoding("\x01\x00", "8bit", "UTF-16BE")); // codepoints over 0xFF are illegal for '8-bit'
2121
echo "8bit done\n";
2222

23-
// UCS-4
24-
echo bin2hex(mb_convert_encoding("\xFF\xFE\x00\x00\x00\x30\x00\x00", "UTF-16BE", "UCS-4")), "\n";
25-
echo bin2hex(mb_convert_encoding("\x00\x00\xFE\xFF\x00\x00\x30\x01", "UTF-16BE", "UCS-4")), "\n";
26-
echo bin2hex(mb_convert_encoding("\x02\x30\x00\x00", "UTF-16BE", "UCS-4LE")), "\n";
27-
echo bin2hex(mb_convert_encoding("\x00\x00\x30\x03", "UTF-16BE", "UCS-4BE")), "\n";
28-
29-
mb_substitute_character("long");
30-
echo mb_convert_encoding("\x01\x02\x03", "UTF-8", "UCS-4"), "\n";
31-
echo "UCS-4 done\n";
32-
3323
?>
3424
--EXPECT--
3525
string(3) "ABC"
@@ -38,9 +28,3 @@ string(3) "ABC"
3828
7bit done
3929
string(1) "%"
4030
8bit done
41-
3000
42-
3001
43-
3002
44-
3003
45-
%
46-
UCS-4 done

ext/mbstring/tests/ucs4_encoding.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ mbstring
77
include('encoding_tests.inc');
88
mb_substitute_character(0x25);
99

10+
testValidString("\xFF\xFE\x00\x00\x00\x30\x00\x00", "\x30\x00", "UCS-4", "UTF-16BE", false);
11+
testValidString("\x00\x00\xFE\xFF\x00\x00\x30\x01", "\x30\x01", "UCS-4", "UTF-16BE", false);
12+
testValidString("\x02\x30\x00\x00", "\x30\x02", "UCS-4LE", "UTF-16BE");
13+
testValidString("\x00\x00\x30\x03", "\x30\x03", "UCS-4BE", "UTF-16BE");
14+
15+
convertInvalidString("\x01\x02\x03", "%", "UCS-4", "UTF-8");
16+
1017
// Test "long" illegal character markers
1118
mb_substitute_character("long");
1219
convertInvalidString("\x6F\x00\x00\x00", "U+6F000000", "UCS-4BE", "UTF-8");

0 commit comments

Comments
 (0)