Author: chromatic
Date: Wed Jun 13 23:41:07 2007
New Revision: 18997
Modified:
trunk/runtime/parrot/library/Test/Builder.pir
trunk/runtime/parrot/library/Test/Builder/Output.pir
trunk/runtime/parrot/library/Test/Builder/Test.pir
trunk/runtime/parrot/library/Test/Builder/TestPlan.pir
trunk/runtime/parrot/library/Test/Builder/Tester.pir
Log:
[library] Minor updates to Test::More and friends.
The biggest change is fixing the singleton-enabling init method swap, which is
important for you'll see in a few minutes....
Modified: trunk/runtime/parrot/library/Test/Builder.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/Builder.pir (original)
+++ trunk/runtime/parrot/library/Test/Builder.pir Wed Jun 13 23:41:07 2007
@@ -99,7 +99,6 @@
.local pmc testplan
.local pmc results
- null args
(output, testplan, results) = self.'_assign_default_args'( args )
self.'_assign_args'( output, testplan, results )
.end
@@ -119,13 +118,11 @@
.param pmc testplan
.param pmc results
- .local int offset
- classoffset offset, self, 'Test::Builder'
- setattribute self, offset, output
- inc offset
- setattribute self, offset, testplan
- inc offset
- setattribute self, offset, results
+ setattribute self, "output", output
+ setattribute self, "testplan", testplan
+ setattribute self, "results", results
+
+ results = self.'results'()
.end
=item C<create( args_hash )>
@@ -170,9 +167,9 @@
find_type test_builder_type, 'Test::Builder'
.local pmc real_init
.local pmc blank_init
- real_init = find_global 'Test::Builder', '__init'
- blank_init = find_global 'Test::Builder', '__fake_init'
- store_global 'Test::Builder', '__init', blank_init
+ real_init = find_global 'Test::Builder', 'init'
+ blank_init = find_global 'Test::Builder', 'fake_init'
+ store_global 'Test::Builder', 'init', blank_init
.local pmc test
test = new test_builder_type
@@ -244,33 +241,24 @@
.sub output :method
.local pmc output
- .local int offset
- classoffset offset, self, 'Test::Builder'
- getattribute output, self, offset
+ getattribute output, self, "output"
.return( output )
.end
.sub testplan :method
.local pmc testplan
- .local int offset
- classoffset offset, self, 'Test::Builder'
- inc offset
- getattribute testplan, self, offset
+ getattribute testplan, self, "testplan"
.return( testplan )
.end
.sub results :method
- .local pmc output
- .local int offset
.local pmc results
- classoffset offset, self, 'Test::Builder'
- offset += 2
- getattribute results, self, offset
+ getattribute results, self, "results"
.return( results )
.end
@@ -395,10 +383,8 @@
.local string header
header = testplan.'header'()
- .local int offset
- classoffset offset, self, 'Test::Builder'
- inc offset
- setattribute self, offset, testplan
+ setattribute self, "testplan", testplan
+
output.write( header )
.end
@@ -656,7 +642,7 @@
=head1 COPYRIGHT
-Copyright (C) 2005, The Perl Foundation.
+Copyright (C) 2005-2007, The Perl Foundation.
=cut
Modified: trunk/runtime/parrot/library/Test/Builder/Output.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/Builder/Output.pir (original)
+++ trunk/runtime/parrot/library/Test/Builder/Output.pir Wed Jun 13
23:41:07 2007
@@ -65,29 +65,22 @@
getstderr diag_output
SET_OUTPUT:
- .local int offset
- classoffset offset, self, 'Test::Builder::Output'
- setattribute self, offset, output
- inc offset
- setattribute self, offset, diag_output
+ setattribute self, "output", output
+ setattribute self, "diag_output", diag_output
.end
.sub output :method
.local pmc output
- .local int offset
- classoffset offset, self, 'Test::Builder::Output'
- getattribute output, self, offset
+ getattribute output, self, "output"
.return( output )
.end
.sub diag_output :method
.local pmc diag_output
- .local int offset
- classoffset offset, self, 'Test::Builder::Output'
- getattribute diag_output, self, offset
+ getattribute diag_output, self, "diag_output"
.return( diag_output )
.end
@@ -210,7 +203,7 @@
=head1 COPYRIGHT
-Copyright (C) 2005, The Perl Foundation.
+Copyright (C) 2005-2007, The Perl Foundation.
=cut
Modified: trunk/runtime/parrot/library/Test/Builder/Test.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/Builder/Test.pir (original)
+++ trunk/runtime/parrot/library/Test/Builder/Test.pir Wed Jun 13 23:41:07 2007
@@ -132,17 +132,13 @@
.sub init_pmc :vtable :method
.param pmc args
- .local int offset
.local pmc passed
.local pmc number
.local pmc diagnostic
.local pmc description
- classoffset offset, self, 'Test::Builder::Test::Base'
-
passed = args['passed']
- setattribute self, offset, passed
- inc offset
+ setattribute self, "passed", passed
number = args['number']
unless null number goto SET_NUMBER
@@ -150,8 +146,7 @@
number = 0
SET_NUMBER:
- setattribute self, offset, number
- inc offset
+ setattribute self, "number", number
diagnostic = args['diagnostic']
unless null diagnostic goto SET_DIAGNOSTIC
@@ -159,8 +154,7 @@
set diagnostic, '???'
SET_DIAGNOSTIC:
- setattribute self, offset, diagnostic
- inc offset
+ setattribute self, "diagnostic", diagnostic
description = args['description']
unless null description goto SET_DESCRIPTION
@@ -168,49 +162,38 @@
set description, ''
SET_DESCRIPTION:
- setattribute self, offset, description
+ setattribute self, "description", description
.end
.sub passed :method
.local pmc passed
- .local int offset
- classoffset offset, self, 'Test::Builder::Test::Base'
- getattribute passed, self, offset
+ getattribute passed, self, "passed"
.return( passed )
.end
.sub number :method
.local pmc number
- .local int offset
- classoffset offset, self, 'Test::Builder::Test::Base'
- inc offset
+ getattribute number, self, "number"
- getattribute number, self, offset
.return( number )
.end
.sub diagnostic :method
.local pmc diagnostic
- .local int offset
- classoffset offset, self, 'Test::Builder::Test::Base'
- add offset, 2
+ getattribute diagnostic, self, "diagnostic"
- getattribute diagnostic, self, offset
.return( diagnostic )
.end
.sub description :method
.local pmc description
- .local int offset
- classoffset offset, self, 'Test::Builder::Test::Base'
- add offset, 3
+ getattribute description, self, "description"
- getattribute description, self, offset
.return( description )
.end
@@ -269,7 +252,6 @@
.sub init_pmc :vtable :method
.param pmc args
- .local int offset
.local pmc reason
reason = new .String
set reason, ''
@@ -280,16 +262,13 @@
reason = args['reason']
SET_ATTRIBUTE:
- classoffset offset, self, 'Test::Builder::Test::WithReason'
- setattribute self, offset, reason
+ setattribute self, "reason", reason
.end
.sub reason :method
.local pmc reason
- .local int offset
- classoffset offset, self, 'Test::Builder::Test::WithReason'
- getattribute reason, self, offset
+ getattribute reason, self, "reason"
.return( reason )
.end
@@ -401,7 +380,7 @@
=head1 COPYRIGHT
-Copyright (C) 2005, The Perl Foundation.
+Copyright (C) 2005-2007, The Perl Foundation.
=cut
Modified: trunk/runtime/parrot/library/Test/Builder/TestPlan.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/Builder/TestPlan.pir (original)
+++ trunk/runtime/parrot/library/Test/Builder/TestPlan.pir Wed Jun 13
23:41:07 2007
@@ -67,13 +67,10 @@
throw plan_exception
SET_ATTRIBUTES:
- .local int offset
- classoffset offset, self, 'Test::Builder::TestPlan'
-
.local pmc intvalue
intvalue = new .Integer
intvalue = expect
- setattribute self, offset, intvalue
+ setattribute self, "expect", intvalue
.end
=item C<header()>
@@ -85,13 +82,10 @@
.sub header :method
.local string expect
- .local int offset
.local string header
- classoffset offset, self, 'Test::Builder::TestPlan'
-
.local pmc expect_int
- getattribute expect_int, self, offset
+ getattribute expect_int, self, "expect"
expect = expect_int
header = '1..'
@@ -111,15 +105,12 @@
.param int ran
.local int expect
- .local int offset
.local string footer
.local string expect_string
.local string ran_string
- classoffset offset, self, 'Test::Builder::TestPlan'
-
.local pmc expect_int
- getattribute expect_int, self, offset
+ getattribute expect_int, self, "expect"
expect = expect_int
expect_string = expect_int
@@ -168,7 +159,7 @@
=head1 COPYRIGHT
-Copyright (C) 2005, The Perl Foundation.
+Copyright (C) 2005-2007, The Perl Foundation.
=cut
Modified: trunk/runtime/parrot/library/Test/Builder/Tester.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/Builder/Tester.pir (original)
+++ trunk/runtime/parrot/library/Test/Builder/Tester.pir Wed Jun 13
23:41:07 2007
@@ -75,34 +75,29 @@
.end
.sub init :vtable :method
- .local int offset
- classoffset offset, self, 'Test::Builder::Tester::Output'
-
.local pmc output
.local pmc diagnostics
output = new .ResizablePMCArray
diagnostics = new .ResizablePMCArray
- setattribute self, offset, output
- inc offset
- setattribute self, offset, diagnostics
+
+ setattribute self, "output", output
+ setattribute self, "diagnostics", diagnostics
+
.end
.sub get_output :method
- .local int offset
- classoffset offset, self, 'Test::Builder::Tester::Output'
-
.local pmc output
- getattribute output, self, offset
+
+ getattribute output, self, "output"
+
.return( output )
.end
.sub get_diagnostics :method
- .local int offset
- classoffset offset, self, 'Test::Builder::Tester::Output'
- inc offset
-
.local pmc diagnostics
- getattribute diagnostics, self, offset
+
+ getattribute diagnostics, self, "diagnostics"
+
.return( diagnostics )
.end
@@ -464,7 +459,7 @@
=head1 COPYRIGHT
-Copyright (C) 2005-2006, The Perl Foundation.
+Copyright (C) 2005-2007, The Perl Foundation.
=cut