From 591097e07a9ddfd1783a99ea394ab7e4113242b3 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 28 Jun 2012 00:39:11 -0500 Subject: [PATCH] more in depth tests for 8e4ecf2 --- t/op/write.t | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/t/op/write.t b/t/op/write.t index b0bbc00..29b5b8a 100644 --- a/t/op/write.t +++ b/t/op/write.t @@ -61,7 +61,7 @@ for my $tref ( @NumTests ){ my $bas_tests = 20; # number of tests in section 3 -my $bug_tests = 8 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 3 + 16; +my $bug_tests = 8 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 3 + 96; # number of tests in section 4 my $hmb_tests = 35; @@ -832,6 +832,7 @@ select +(select(RT73690), do { . my @ret; + @ret = write; is(scalar(@ret), 1); ok($ret[0]); @@ -845,6 +846,61 @@ select +(select(RT73690), do { is(scalar(@ret), 1); ok($ret[0]); + @ret = ('a', write, 'z'); + is(scalar(@ret), 3); + is($ret[0], 'a'); + ok($ret[1]); + is($ret[2], 'z'); + @ret = ('b', scalar(write), 'y'); + is(scalar(@ret), 3); + is($ret[0], 'b'); + ok($ret[1]); + is($ret[2], 'y'); + @ret = ('c', write(RT73690), 'x'); + is(scalar(@ret), 3); + is($ret[0], 'c'); + ok($ret[1]); + is($ret[2], 'x'); + @ret = ('d', scalar(write(RT73690)), 'w'); + is(scalar(@ret), 3); + is($ret[0], 'd'); + ok($ret[1]); + is($ret[2], 'w'); + + @ret = do { write; 'foo' }; + is(scalar(@ret), 1); + is($ret[0], 'foo'); + @ret = do { scalar(write); 'bar' }; + is(scalar(@ret), 1); + is($ret[0], 'bar'); + @ret = do { write(RT73690); 'baz' }; + is(scalar(@ret), 1); + is($ret[0], 'baz'); + @ret = do { scalar(write(RT73690)); 'quux' }; + is(scalar(@ret), 1); + is($ret[0], 'quux'); + + @ret = ('a', do { write; 'foo' }, 'z'); + is(scalar(@ret), 3); + is($ret[0], 'a'); + is($ret[1], 'foo'); + is($ret[2], 'z'); + @ret = ('b', do { scalar(write); 'bar' }, 'y'); + is(scalar(@ret), 3); + is($ret[0], 'b'); + is($ret[1], 'bar'); + is($ret[2], 'y'); + @ret = ('c', do { write(RT73690); 'baz' }, 'x'); + is(scalar(@ret), 3); + is($ret[0], 'c'); + is($ret[1], 'baz'); + is($ret[2], 'x'); + @ret = ('d', do { scalar(write(RT73690)); 'quux' }, 'w'); + is(scalar(@ret), 3); + is($ret[0], 'd'); + is($ret[1], 'quux'); + is($ret[2], 'w'); + close RT73690 or die "Could not close: $!"; })[0]; @@ -856,6 +912,7 @@ return . my @ret; + @ret = write; is(scalar(@ret), 1); ok(!$ret[0]); @@ -869,6 +926,61 @@ return is(scalar(@ret), 1); ok(!$ret[0]); + @ret = ('a', write, 'z'); + is(scalar(@ret), 3); + is($ret[0], 'a'); + ok(!$ret[1]); + is($ret[2], 'z'); + @ret = ('b', scalar(write), 'y'); + is(scalar(@ret), 3); + is($ret[0], 'b'); + ok(!$ret[1]); + is($ret[2], 'y'); + @ret = ('c', write(RT73690_2), 'x'); + is(scalar(@ret), 3); + is($ret[0], 'c'); + ok(!$ret[1]); + is($ret[2], 'x'); + @ret = ('d', scalar(write(RT73690_2)), 'w'); + is(scalar(@ret), 3); + is($ret[0], 'd'); + ok(!$ret[1]); + is($ret[2], 'w'); + + @ret = do { write; 'foo' }; + is(scalar(@ret), 1); + is($ret[0], 'foo'); + @ret = do { scalar(write); 'bar' }; + is(scalar(@ret), 1); + is($ret[0], 'bar'); + @ret = do { write(RT73690_2); 'baz' }; + is(scalar(@ret), 1); + is($ret[0], 'baz'); + @ret = do { scalar(write(RT73690_2)); 'quux' }; + is(scalar(@ret), 1); + is($ret[0], 'quux'); + + @ret = ('a', do { write; 'foo' }, 'z'); + is(scalar(@ret), 3); + is($ret[0], 'a'); + is($ret[1], 'foo'); + is($ret[2], 'z'); + @ret = ('b', do { scalar(write); 'bar' }, 'y'); + is(scalar(@ret), 3); + is($ret[0], 'b'); + is($ret[1], 'bar'); + is($ret[2], 'y'); + @ret = ('c', do { write(RT73690_2); 'baz' }, 'x'); + is(scalar(@ret), 3); + is($ret[0], 'c'); + is($ret[1], 'baz'); + is($ret[2], 'x'); + @ret = ('d', do { scalar(write(RT73690_2)); 'quux' }, 'w'); + is(scalar(@ret), 3); + is($ret[0], 'd'); + is($ret[1], 'quux'); + is($ret[2], 'w'); + close RT73690_2 or die "Could not close: $!"; })[0]; -- 2.7.4