[svn:parrot] r44561 - branches/ops_pct/compilers/opsc/t
bacek at svn.parrot.org
bacek at svn.parrot.org
Mon Mar 1 05:54:20 UTC 2010
Author: bacek
Date: Mon Mar 1 05:54:20 2010
New Revision: 44561
URL: https://trac.parrot.org/parrot/changeset/44561
Log:
Add tests for Ops::Op
Added:
branches/ops_pct/compilers/opsc/t/04-op.t
Added: branches/ops_pct/compilers/opsc/t/04-op.t
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/ops_pct/compilers/opsc/t/04-op.t Mon Mar 1 05:54:20 2010 (r44561)
@@ -0,0 +1,35 @@
+#!./parrot-nqp
+
+# Checking Ops::Op
+
+pir::load_bytecode("compilers/opsc/opsc.pbc");
+pir::load_bytecode("nqp-settings.pbc");
+
+plan(7);
+
+my $ok := 1;
+try {
+ Ops::Op.new(code => "BANG");
+ $ok := 0;
+}
+
+ok( $ok, "Can't create Op without mandatory arguments");
+
+my $op := Ops::Op.new(
+ code => 42,
+ name => 'set',
+ type => 'inline',
+ args => <foo bar baz>,
+ flags => hash()
+);
+
+ok( 1, "Op created");
+
+ok( $op.code == 42, "... with proper code");
+ok( $op.name == 'set', "... with proper name");
+ok( $op.type == 'inline', "... with proper type");
+ok( $op.body == '', "... with empty body");
+$op.body("SOME BODY");
+ok( $op.body == 'SOME BODY', "Op.body set");
+
+# vim: expandtab shiftwidth=4 ft=perl6:
More information about the parrot-commits
mailing list