[svn:parrot] r41131 - trunk/t/pmc
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Mon Sep 7 19:04:08 UTC 2009
Author: whiteknight
Date: Mon Sep 7 19:04:06 2009
New Revision: 41131
URL: https://trac.parrot.org/parrot/changeset/41131
Log:
[t] convert 4 more tests using throws_like. Help from dukeleto++ and moritz++.
Modified:
trunk/t/pmc/namespace-old.t
trunk/t/pmc/namespace.t
Modified: trunk/t/pmc/namespace-old.t
==============================================================================
--- trunk/t/pmc/namespace-old.t Mon Sep 7 19:03:41 2009 (r41130)
+++ trunk/t/pmc/namespace-old.t Mon Sep 7 19:04:06 2009 (r41131)
@@ -6,7 +6,7 @@
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 42;
+use Parrot::Test tests => 38;
use Parrot::Config;
=head1 NAME
@@ -192,78 +192,6 @@
EOF
close $S;
-pir_error_output_like( <<'CODE', <<'OUTPUT', 'export_to() with null destination throws exception' );
-.sub 'test' :main
- .local pmc nsa, nsb, ar
-
- ar = new ['ResizableStringArray']
- push ar, 'foo'
- nsa = new ['Null']
- nsb = get_namespace ['B']
- nsb.'export_to'(nsa, ar)
-.end
-
-.namespace ['B']
-.sub 'foo' :anon
-.end
-CODE
-/^destination namespace not specified\n/
-OUTPUT
-
-pir_error_output_like(
- <<'CODE', <<'OUTPUT', 'export_to() with null exports default object set !!!UNSPECIFIED!!!' );
-.sub 'test' :main
- .local pmc nsa, nsb, ar
-
- ar = new ['Null']
- nsa = get_namespace
- nsb = get_namespace ['B']
- nsb.'export_to'(nsa, ar)
-.end
-
-.namespace ['B']
-.sub 'foo'
-.end
-CODE
-/^exporting default object set not yet implemented\n/
-OUTPUT
-
-pir_error_output_like(
- <<'CODE', <<'OUTPUT', 'export_to() with empty array exports default object set !!!UNSPECIFIED!!!' );
-.sub 'test' :main
- .local pmc nsa, nsb, ar
-
- ar = new ['ResizableStringArray']
- nsa = get_namespace
- nsb = get_namespace ['B']
- nsb.'export_to'(nsa, ar)
-.end
-
-.namespace ['B']
-.sub 'foo'
-.end
-CODE
-/^exporting default object set not yet implemented\n/
-OUTPUT
-
-pir_error_output_like(
- <<'CODE', <<'OUTPUT', 'export_to() with empty hash exports default object set !!!UNSPECIFIED!!!' );
-.sub 'test' :main
- .local pmc nsa, nsb, ar
-
- ar = new ['Hash']
- nsa = get_namespace
- nsb = get_namespace ['B']
- nsb.'export_to'(nsa, ar)
-.end
-
-.namespace ['B']
-.sub 'foo'
-.end
-CODE
-/^exporting default object set not yet implemented\n/
-OUTPUT
-
pir_output_is( <<"CODE", <<'OUTPUT', "export_to -- success with array" );
.HLL 'A'
.sub main :main
@@ -359,6 +287,7 @@
Could not find non-existent sub b_foo/
OUTPUT
+
pir_output_is( <<'CODE', <<'OUTPUT', "get_parent" );
.sub main :main
.local pmc ns
Modified: trunk/t/pmc/namespace.t
==============================================================================
--- trunk/t/pmc/namespace.t Mon Sep 7 19:03:41 2009 (r41130)
+++ trunk/t/pmc/namespace.t Mon Sep 7 19:04:06 2009 (r41131)
@@ -56,7 +56,7 @@
.sub main :main
.include 'test_more.pir'
- plan(66)
+ plan(70)
create_namespace_pmc()
verify_namespace_type()
@@ -70,6 +70,7 @@
anon_function_namespace()
find_name_opcode()
namespace_methods()
+ export_to_method()
.end
# L<PDD21/Namespace PMC API/=head4 Untyped Interface>
@@ -548,6 +549,68 @@
# Test del_var. It will delete any type of thing
.end
+.sub 'export_to_method'
+ .local string errormsg, description
+
+ errormsg = ":s destination namespace not specified"
+ description = "export_to() Null NameSpace"
+ throws_like(<<"CODE", errormsg, description)
+ .sub 'test' :main
+ .local pmc nsa, nsb, ar
+
+ ar = new ['ResizableStringArray']
+ push ar, 'baz'
+ nsa = new ['Null']
+ nsb = get_namespace ['Foo']
+ nsb.'export_to'(nsa, ar)
+ .end
+CODE
+
+ errormsg = ":s exporting default object set not yet implemented"
+ description = 'export_to() with null exports default object set !!!UNSPECIFIED!!!'
+ throws_like(<<'CODE', errormsg, description)
+ .sub 'test' :main
+ .local pmc nsa, nsb, ar
+
+ ar = new ['Null']
+ nsa = get_namespace
+ nsb = get_namespace ['Foo']
+ nsb.'export_to'(nsa, ar)
+ .end
+CODE
+
+
+ errormsg = ":s exporting default object set not yet implemented"
+ description = 'export_to() with empty array exports default object set !!!UNSPECIFIED!!!'
+ throws_like(<<'CODE', errormsg, description)
+ .sub 'test' :main
+ .local pmc nsa, nsb, ar
+
+ ar = new ['ResizableStringArray']
+ nsa = get_namespace
+ nsb = get_namespace ['Foo']
+ nsb.'export_to'(nsa, ar)
+ .end
+CODE
+
+ errormsg = ":s exporting default object set not yet implemented"
+ description = 'export_to() with empty hash exports default object set !!!UNSPECIFIED!!!'
+ throws_like(<<'CODE', errormsg, description)
+ .sub 'test' :main
+ .local pmc nsa, nsb, ar
+
+ ar = new ['Hash']
+ nsa = get_namespace
+ nsb = get_namespace ['Foo']
+ nsb.'export_to'(nsa, ar)
+ .end
+CODE
+
+# Things to add: successful export_to with non-empty array, successful
+# export_to with non-empty hash. both of these things across HLL boundaries
+
+.end
+
##### TEST NAMESPACES AND FUNCTIONS #####
# These functions and namespaces are used for the tests above
More information about the parrot-commits
mailing list