From: Artur Bergman Date: Sat, 8 Jun 2002 19:02:19 +0000 (+0000) Subject: Remove leftover dummy and cleanup the test case. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=48f9166993bf036ac6ac8961cbf8b38e6071a260;p=p5sagit%2Fp5-mst-13.2.git Remove leftover dummy and cleanup the test case. p4raw-id: //depot/perl@17109 --- diff --git a/ext/threads/shared/shared.pm b/ext/threads/shared/shared.pm index f98ca7d..c92bfe5 100644 --- a/ext/threads/shared/shared.pm +++ b/ext/threads/shared/shared.pm @@ -54,7 +54,6 @@ sub share_disabled { return @_} $threads::shared::threads_shared = 1; -sub _thrcnt { 42 } sub threads::shared::tie::SPLICE { diff --git a/ext/threads/shared/t/hv_refs.t b/ext/threads/shared/t/hv_refs.t index 421ed94..31ea5d9 100644 --- a/ext/threads/shared/t/hv_refs.t +++ b/ext/threads/shared/t/hv_refs.t @@ -30,9 +30,9 @@ sub skip { use ExtUtils::testlib; use strict; -BEGIN { print "1..17\n" }; +BEGIN { print "1..13\n" }; use threads; -use threads::shared qw(:DEFAULT _thrcnt _refcnt _id); +use threads::shared qw(:DEFAULT _refcnt _id); ok(1,1,"loaded"); my $foo; share($foo); @@ -44,38 +44,34 @@ $foo = "test"; ok(3, ${$foo{foo}} eq "test", "Check deref after assign"); threads->create(sub{${$foo{foo}} = "test2";})->join(); ok(4, $foo eq "test2", "Check after assign in another thread"); -skip(5, _thrcnt($foo) == 2, "Check refcount"); my $bar = delete($foo{foo}); -ok(6, $$bar eq "test2", "check delete"); -skip(7, _thrcnt($foo) == 1, "Check refcount after delete"); +ok(5, $$bar eq "test2", "check delete"); threads->create( sub { my $test; share($test); $test = "thread3"; $foo{test} = \$test; })->join(); -ok(8, ${$foo{test}} eq "thread3", "Check reference created in another thread"); +ok(6, ${$foo{test}} eq "thread3", "Check reference created in another thread"); my $gg = $foo{test}; $$gg = "test"; -ok(9, ${$foo{test}} eq "test", "Check reference"); -skip(10, _thrcnt($gg) == 2, "Check refcount"); +ok(7, ${$foo{test}} eq "test", "Check reference"); my $gg2 = delete($foo{test}); -skip(11, _thrcnt($gg) == 1, "Check refcount"); -ok(12, _id($$gg) == _id($$gg2), +ok(8, _id($$gg) == _id($$gg2), sprintf("Check we get the same thing (%x vs %x)", _id($$gg),_id($$gg2))); -ok(13, $$gg eq $$gg2, "And check the values are the same"); -ok(14, keys %foo == 0, "And make sure we realy have deleted the values"); +ok(9, $$gg eq $$gg2, "And check the values are the same"); +ok(10, keys %foo == 0, "And make sure we realy have deleted the values"); { my (%hash1, %hash2); share(%hash1); share(%hash2); $hash1{hash} = \%hash2; $hash2{"bar"} = "foo"; - ok(15, $hash1{hash}->{bar} eq "foo", "Check hash references work"); + ok(11, $hash1{hash}->{bar} eq "foo", "Check hash references work"); threads->create(sub { $hash2{"bar2"} = "foo2"})->join(); - ok(16, $hash1{hash}->{bar2} eq "foo2", "Check hash references work"); + ok(12, $hash1{hash}->{bar2} eq "foo2", "Check hash references work"); threads->create(sub { my (%hash3); share(%hash3); $hash2{hash} = \%hash3; $hash3{"thread"} = "yes"})->join(); - ok(17, $hash1{hash}->{hash}->{thread} eq "yes", "Check hash created in another thread"); + ok(13, $hash1{hash}->{hash}->{thread} eq "yes", "Check hash created in another thread"); } diff --git a/ext/threads/shared/t/hv_simple.t b/ext/threads/shared/t/hv_simple.t index fe1ee21..aef965e 100644 --- a/ext/threads/shared/t/hv_simple.t +++ b/ext/threads/shared/t/hv_simple.t @@ -32,7 +32,7 @@ sub skip { use ExtUtils::testlib; use strict; -BEGIN { print "1..21\n" }; +BEGIN { print "1..14\n" }; use threads; use threads::shared; ok(1,1,"loaded"); @@ -65,19 +65,3 @@ ok(12, $seen{3} == 1, "Keys.."); ok(13, $seen{"foo"} == 1, "Keys.."); threads->create(sub { %hash = () })->join(); ok(14, keys %hash == 0, "Check clear"); -skip(15, threads::shared::_thrcnt(%hash) == 1, "thrcnt"); -threads->create(sub { skip(16, threads::shared::_thrcnt(%hash) == 2, "thrcnt is up")})->join(); -skip(17, threads::shared::_thrcnt(%hash) == 1, "thrcnt is down"); -{ - my $test; - my $test2; - share($test); - $test = \%hash; - $test2 = \%hash; - skip(18, threads::shared::_thrcnt(%hash) == 2, "thrcnt is up on shared reference"); - $test = "bar"; - skip(19 , threads::shared::_thrcnt(%hash) == 1, "thrcnt is down when shared reference is dropped"); - $test = $test2; - skip(20, threads::shared::_thrcnt(%hash) == 2, "thrcnt is up on shared reference"); -} -skip(21 , threads::shared::_thrcnt(%hash) == 1, "thrcnt is down when shared reference is killed");