cvsuser 04/03/11 09:09:56
Modified: t/pmc object-meths.t
Log:
PIR meth call syntax - 8 - more tests
Revision Changes Path
1.11 +122 -17 parrot/t/pmc/object-meths.t
Index: object-meths.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/object-meths.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -r1.10 -r1.11
--- object-meths.t 11 Mar 2004 16:14:52 -0000 1.10
+++ object-meths.t 11 Mar 2004 17:09:55 -0000 1.11
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: object-meths.t,v 1.10 2004/03/11 16:14:52 dan Exp $
+# $Id: object-meths.t,v 1.11 2004/03/11 17:09:55 leo Exp $
=head1 NAME
@@ -16,7 +16,7 @@
=cut
-use Parrot::Test tests => 8;
+use Parrot::Test tests => 10;
use Test::More;
output_like(<<'CODE', <<'OUTPUT', "callmethod - unknown");
@@ -210,7 +210,6 @@
.sub foo method
.local pmc B
- self = P2
print "A::foo\n"
getprop B, "B", self
@@ -218,28 +217,134 @@
B."blah"()
self."blah"()
- .pcc_begin_return
- .pcc_end_return
.end
.sub blah method
print "A::blah\n"
- .pcc_begin_return
- .pcc_end_return
.end
.namespace ["B"]
.sub foo method
print "B::foo\n"
- .pcc_begin_return
- .pcc_end_return
.end
.sub blah method
print "B::blah\n"
+.end
+CODE
+A::foo
+A::blah
+B::blah
+A::blah
+B::foo
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "methods: self w arg");
+##PIR##
+.sub _main
+ .local pmc A
+ .local pmc B
+
+ newclass A, "A"
+ newclass B, "B"
+
+ find_type I0, "A"
+ find_type I1, "B"
+
+ new A, I0
+ new B, I1
+
+ A."foo"(B)
+ B."foo"()
+
+ end
+.end
+
+.namespace ["A"]
+
+.sub foo method
+ .param pmc B
+
+ print "A::foo\n"
+
+ self."blah"()
+ B."blah"()
+ self."blah"()
+
+.end
+
+.sub blah method
+ print "A::blah\n"
+.end
+
+.namespace ["B"]
+
+.sub foo method
+ print "B::foo\n"
+.end
+
+.sub blah method
+ print "B::blah\n"
+.end
+CODE
+A::foo
+A::blah
+B::blah
+A::blah
+B::foo
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "methods: self w arg and ret");
+##PIR##
+.sub _main
+ .local pmc A
+ .local pmc B
+
+ newclass A, "A"
+ newclass B, "B"
+
+ find_type I0, "A"
+ find_type I1, "B"
+
+ new A, I0
+ new B, I1
+
+ .local pmc r
+ r = A."foo"(B)
+ r."foo"()
+
+ end
+.end
+
+.namespace ["A"]
+
+.sub foo method
+ .param pmc B
+
+ print "A::foo\n"
+
+ self."blah"()
+ B."blah"()
+ self."blah"()
.pcc_begin_return
+ .return B
.pcc_end_return
+
+.end
+
+.sub blah method
+ print "A::blah\n"
+.end
+
+.namespace ["B"]
+
+.sub foo method
+ print "B::foo\n"
+.end
+
+.sub blah method
+ print "B::blah\n"
.end
CODE
A::foo