diff options
author | Nicholas Clark <nick@ccl4.org> | 2004-12-29 21:24:30 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-12-29 21:24:30 +0000 |
commit | 39cd9b99380da8b915ef4e52d215f1675bff6753 (patch) | |
tree | e28491b00e6fb025e1b79015172bef968d08716c /t/op/read.t | |
parent | 9b9d7ce8d832b4fbcb890a8f326b7b630d9396fa (diff) | |
download | perl-39cd9b99380da8b915ef4e52d215f1675bff6753.tar.gz |
Skip tests that binmode :utf8 if there is no perlio
p4raw-id: //depot/perl@23706
Diffstat (limited to 't/op/read.t')
-rwxr-xr-x | t/op/read.t | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/t/op/read.t b/t/op/read.t index 58190113a3..4aaaeabdfe 100755 --- a/t/op/read.t +++ b/t/op/read.t @@ -25,6 +25,14 @@ $got = read(FOO,$buf,4); is ($got, 0); is ($buf, ""); +# This is true if Config is not built, or if PerlIO is enabled +# ie assume that PerlIO is present, unless we know for sure otherwise. +my $has_perlio = !eval { + no warnings; + require Config; + !$Config::Config{useperlio} +}; + my $tmpfile = 'Op_read.tmp'; 1 while unlink $tmpfile; @@ -35,6 +43,8 @@ foreach (65, 161, 253, 9786) { push @values, join "", map {chr $_} $_ .. $_ + 4; push @buffers, join "", map {chr $_} $_ + 5 .. $_ + 20; } +my @offsets = (0, 3, 7, 22, -1, -3, -5, -7); +my @lengths = (0, 2, 5, 10); foreach my $value (@values) { foreach my $initial_buffer (@buffers) { @@ -43,14 +53,18 @@ foreach my $value (@values) { # It's all 8 bit unshift @utf8, 0; } + SKIP: foreach my $utf8 (@utf8) { + skip "Needs :utf8 layer but no perlio", 2 * @offsets * @lengths + if $utf8 and !$has_perlio; + 1 while unlink $tmpfile; open FH, ">$tmpfile" or die "Can't open $tmpfile: $!"; binmode FH, "utf8" if $utf8; print FH $value; close FH; - foreach my $offset (0, 3, 7, 22, -1, -3, -5, -7) { - foreach my $length (0, 2, 5, 10) { + foreach my $offset (@offsets) { + foreach my $length (@lengths) { # Will read the lesser of the length of the file and the # read length my $will_read = $value; |