Author: allison
Date: Sun Mar 4 06:59:45 2007
New Revision: 17329
Modified:
trunk/t/pmc/smop_attribute.t
trunk/t/pmc/smop_class.t
Log:
[objects]: Converting SMOP prototype tests to PIR.
Modified: trunk/t/pmc/smop_attribute.t
==============================================================================
--- trunk/t/pmc/smop_attribute.t (original)
+++ trunk/t/pmc/smop_attribute.t Sun Mar 4 06:59:45 2007
@@ -1,13 +1,7 @@
-#!perl
-# Copyright (C) 2006, The Perl Foundation.
+#!./parrot
+# Copyright (C) 2007, The Perl Foundation.
# $Id$
-use strict;
-use warnings;
-use lib qw( . lib ../lib ../../lib );
-use Test::More;
-use Parrot::Test tests => 5;
-
=head1 NAME
t/pmc/smop_attribute.t - test the new SMOP Attribute PMC
@@ -23,45 +17,39 @@
=cut
-pir_output_is( <<'CODE', <<'OUT', 'create a SMOP_Attribute' );
-.sub main :main
- $P0 = new 'SMOP_Attribute'
-.end
-CODE
-OUT
+.macro IMPORT ( lib, subname, TEMP )
+ .TEMP = find_global .lib, .subname
+ store_global .subname, .TEMP
+.endm
+
+.sub _main :main
+ load_bytecode 'library/Test/More.pir'
+
+ .local pmc _
+ .IMPORT( 'Test::More', 'plan', _ )
+ .IMPORT( 'Test::More', 'ok', _ )
+ .IMPORT( 'Test::More', 'is', _ )
+
+ plan( 9 )
+
+ $P0 = new 'SMOP_Attribute'
+# ok ($P0, 'create a SMOP_Attribute')
+ ok (1, 'create a SMOP_Attribute')
+
-pir_output_is( <<'CODE', <<'OUT', 'test the SMOP_Attribute name method' );
-.sub main :main
$P0 = new 'SMOP_Attribute'
$S0 = $P0.'name'("TestClass1")
- print $S0
- print "\n"
+ is ($S0, 'TestClass1', 'test the SMOP_Attribute name method')
+
$S1 = $P0.'name'()
- print $S1
- print "\n"
-.end
-CODE
-TestClass1
-TestClass1
-OUT
+ is ($S1, 'TestClass1', 'test the SMOP_Attribute name method')
-pir_output_is( <<'CODE', <<'OUT', 'test the SMOP_Attribute type method' );
-.sub main :main
$P0 = new 'SMOP_Attribute'
$S0 = $P0.'type'("TestTypeClass1")
- print $S0
- print "\n"
+ is ($S0, 'TestTypeClass1', 'test the SMOP_Attribute name method')
$S1 = $P0.'type'()
- print $S1
- print "\n"
-.end
-CODE
-TestTypeClass1
-TestTypeClass1
-OUT
+ is ($S1, 'TestTypeClass1', 'test the SMOP_Attribute name method')
-pir_output_is( <<'CODE', <<'OUT', 'test the SMOP_Attribute type method with a
ResizableIntegerArray' );
-.sub main :main
$P1 = new 'ResizableIntegerArray'
push $P1, 1
push $P1, 2
@@ -70,20 +58,12 @@
$P0 = new 'SMOP_Attribute'
$P2 = $P0.'class'($P1)
get_repr $S0, $P2
- print $S0
- print "\n"
+ is ($S0, '[ 1, 2, 3 ]', 'test the SMOP_Attribute type method with a
ResizableIntegerArray' )
$P3 = $P0.'class'()
get_repr $S1, $P3
- print $S1
- print "\n"
-.end
-CODE
-[ 1, 2, 3 ]
-[ 1, 2, 3 ]
-OUT
+ is ($S1, '[ 1, 2, 3 ]', 'test the SMOP_Attribute type method with a
ResizableIntegerArray' )
+
-pir_output_is( <<'CODE', <<'OUT', 'test the SMOP_Attribute class method with a
FixedIntegerArray' );
-.sub main :main
$P1 = new 'FixedIntegerArray'
set $P1, 3
$P1[0]= 1
@@ -93,21 +73,15 @@
$P0 = new 'SMOP_Attribute'
$P2 = $P0.'class'($P1)
get_repr $S0, $P2
- print $S0
- print "\n"
+ is( $S0, '[ 1, 2, 3 ]', 'test the SMOP_Attribute class method with a
FixedIntegerArray' )
$P3 = $P0.'class'()
get_repr $S1, $P3
- print $S1
- print "\n"
+ is( $S1, '[ 1, 2, 3 ]', 'test the SMOP_Attribute class method with a
FixedIntegerArray' )
+
.end
-CODE
-[ 1, 2, 3 ]
-[ 1, 2, 3 ]
-OUT
# Local Variables:
-# mode: cperl
-# cperl-indent-level: 4
+# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4:
Modified: trunk/t/pmc/smop_class.t
==============================================================================
--- trunk/t/pmc/smop_class.t (original)
+++ trunk/t/pmc/smop_class.t Sun Mar 4 06:59:45 2007
@@ -1,13 +1,7 @@
-#!perl
-# Copyright (C) 2006, The Perl Foundation.
+#!./parrot
+# Copyright (C) 2007, The Perl Foundation.
# $Id$
-use strict;
-use warnings;
-use lib qw( . lib ../lib ../../lib );
-use Test::More;
-use Parrot::Test tests => 1;
-
=head1 NAME
t/pmc/smop_class.t - test the new SMOP Class PMC
@@ -23,17 +17,29 @@
=cut
-pir_output_is( <<'CODE', <<'OUT', 'create a SMOP_Class' );
-.sub main :main
- $P0 = new 'SMOP_Class'
+.macro IMPORT ( lib, subname, TEMP )
+ .TEMP = find_global .lib, .subname
+ store_global .subname, .TEMP
+.endm
+
+.sub _main :main
+ load_bytecode 'library/Test/More.pir'
+
+ .local pmc _
+ .IMPORT( 'Test::More', 'plan', _ )
+ .IMPORT( 'Test::More', 'ok', _ )
+ .IMPORT( 'Test::More', 'is', _ )
+
+ plan( 1 )
+
+ $P0 = new 'SMOP_Class'
+ ok (1)
+# ok ($P0)
.end
-CODE
-OUT
# Local Variables:
-# mode: cperl
-# cperl-indent-level: 4
+# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: