diff options
author | Mark Pulford <mark@kyne.com.au> | 2011-12-08 18:47:26 +1030 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2011-12-08 18:47:26 +1030 |
commit | bea23facc1644cffa53ecc84fa236806e9c94dfd (patch) | |
tree | ed69b92925a814f8ba118561923beeaf25f4a763 /tests | |
parent | 3db502c9ba1b2bc06fd5ef2bc76698833d0b9d89 (diff) | |
download | lua-cjson-bea23facc1644cffa53ecc84fa236806e9c94dfd.tar.gz lua-cjson-bea23facc1644cffa53ecc84fa236806e9c94dfd.tar.bz2 lua-cjson-bea23facc1644cffa53ecc84fa236806e9c94dfd.zip |
Silence genutf8.pl warnings across Perl versions
- Use Perl filehandles directly since IO::Handle generates
unicode warnings that can't be silenced.
- Disable all warnings since the specific "nonchar" warning only
exists in newer versions.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/genutf8.pl | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/tests/genutf8.pl b/tests/genutf8.pl index bbef91f..db661a1 100755 --- a/tests/genutf8.pl +++ b/tests/genutf8.pl | |||
@@ -2,31 +2,22 @@ | |||
2 | 2 | ||
3 | # Create test comparison data using a different UTF-8 implementation. | 3 | # Create test comparison data using a different UTF-8 implementation. |
4 | 4 | ||
5 | # The generation utf8.dat file must have the following MD5 sum: | 5 | # The generated utf8.dat file must have the following MD5 sum: |
6 | # cff03b039d850f370a7362f3313e5268 | 6 | # cff03b039d850f370a7362f3313e5268 |
7 | 7 | ||
8 | use strict; | 8 | use strict; |
9 | use warnings; | ||
10 | use FileHandle; | ||
11 | 9 | ||
12 | # 0xD800 - 0xDFFF are used to encode supplementary codepoints | 10 | # 0xD800 - 0xDFFF are used to encode supplementary codepoints |
13 | # 0x10000 - 0x10FFFF are supplementary codepoints | 11 | # 0x10000 - 0x10FFFF are supplementary codepoints |
14 | my (@codepoints) = (0 .. 0xD7FF, 0xE000 .. 0x10FFFF); | 12 | my (@codepoints) = (0 .. 0xD7FF, 0xE000 .. 0x10FFFF); |
15 | 13 | ||
16 | my ($utf8); | 14 | my $utf8 = pack("U*", @codepoints); |
17 | { | ||
18 | # Hide "Unicode character X is illegal" warnings. | ||
19 | # We want all the codes to test the UTF-8 escape decoder. | ||
20 | no warnings; | ||
21 | $utf8 = pack("U*", @codepoints); | ||
22 | } | ||
23 | defined($utf8) or die "Unable create UTF-8 string\n"; | 15 | defined($utf8) or die "Unable create UTF-8 string\n"; |
24 | 16 | ||
25 | my $fh = FileHandle->new(); | 17 | open(FH, ">:utf8", "utf8.dat") |
26 | $fh->open("utf8.dat", ">:utf8") | ||
27 | or die "Unable to open utf8.dat: $!\n"; | 18 | or die "Unable to open utf8.dat: $!\n"; |
28 | $fh->write($utf8) | 19 | print FH $utf8 |
29 | or die "Unable to write utf8.dat\n"; | 20 | or die "Unable to write utf8.dat\n"; |
30 | $fh->close(); | 21 | close(FH); |
31 | 22 | ||
32 | # vi:ai et sw=4 ts=4: | 23 | # vi:ai et sw=4 ts=4: |