[svn:parrot] r48951 - in trunk/runtime/parrot: include library/Test library/Test/Builder

fperrad at svn.parrot.org fperrad at svn.parrot.org
Sun Sep 12 09:25:54 UTC 2010


Author: fperrad
Date: Sun Sep 12 09:25:53 2010
New Revision: 48951
URL: https://trac.parrot.org/parrot/changeset/48951

Log:
[library] completes the implementation of skip_all

Modified:
   trunk/runtime/parrot/include/test_more.pir
   trunk/runtime/parrot/library/Test/Builder.pir
   trunk/runtime/parrot/library/Test/Builder/TestPlan.pir
   trunk/runtime/parrot/library/Test/More.pir

Modified: trunk/runtime/parrot/include/test_more.pir
==============================================================================
--- trunk/runtime/parrot/include/test_more.pir	Sun Sep 12 01:08:04 2010	(r48950)
+++ trunk/runtime/parrot/include/test_more.pir	Sun Sep 12 09:25:53 2010	(r48951)
@@ -20,7 +20,7 @@
     .local pmc exports, curr_namespace, test_namespace
     curr_namespace = get_namespace
     test_namespace = get_root_namespace [ 'parrot'; 'Test'; 'More' ]
-    exports = split ' ', 'plan diag ok nok is is_deeply is_null like substring isa_ok skip isnt todo throws_like lives_ok dies_ok throws_substring done_testing'
+    exports = split ' ', 'plan diag ok nok is is_deeply is_null like substring isa_ok skip skip_all isnt todo throws_like lives_ok dies_ok throws_substring done_testing'
 
     test_namespace.'export_to'(curr_namespace, exports)
 

Modified: trunk/runtime/parrot/library/Test/Builder.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/Builder.pir	Sun Sep 12 01:08:04 2010	(r48950)
+++ trunk/runtime/parrot/library/Test/Builder.pir	Sun Sep 12 09:25:53 2010	(r48951)
@@ -494,6 +494,9 @@
 =cut
 
 .sub 'skip_all' :method
+    .param string reason  :optional
+    .param int has_reason :opt_flag
+
     .local pmc testplan
     testplan = self.'testplan'()
 
@@ -505,9 +508,14 @@
     throw plan_exception
 
   SKIP_ALL:
+    $S0 = "1..0 # SKIP"
+    unless has_reason goto NO_REASON
+    $S0 .= " "
+    $S0 .= reason
+  NO_REASON: 
     .local pmc output
     output = self.'output'()
-    output.'write'( "1..0" )
+    output.'write'( $S0 )
     exit 0
 .end
 

Modified: trunk/runtime/parrot/library/Test/Builder/TestPlan.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/Builder/TestPlan.pir	Sun Sep 12 01:08:04 2010	(r48950)
+++ trunk/runtime/parrot/library/Test/Builder/TestPlan.pir	Sun Sep 12 09:25:53 2010	(r48951)
@@ -54,6 +54,15 @@
     setattribute self, 'plan', plan
 .end
 
+.sub 'get_bool' :vtable :method
+    .local pmc plan
+    plan = getattribute self, 'plan'
+
+    $I0 = isa plan, [ 'Test'; 'Builder'; 'NullPlan' ]
+    $I0 = not $I0
+    .return ($I0)
+.end
+
 .sub 'set_tests' :method
     .param int tests
 

Modified: trunk/runtime/parrot/library/Test/More.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/More.pir	Sun Sep 12 01:08:04 2010	(r48950)
+++ trunk/runtime/parrot/library/Test/More.pir	Sun Sep 12 09:25:53 2010	(r48951)
@@ -13,7 +13,7 @@
     .local pmc exports, curr_namespace, test_namespace
     curr_namespace = get_namespace
     test_namespace = get_namespace [ 'Test'; 'More' ]
-    exports        = split ' ', 'plan diag ok nok is is_deeply like isa_ok skip isnt todo throws_like lives_ok dies_ok'
+    exports        = split ' ', 'plan diag ok nok is is_deeply like isa_ok skip skip_all isnt todo throws_like lives_ok dies_ok'
 
     test_namespace.'export_to'(curr_namespace, exports)
 
@@ -1318,6 +1318,18 @@
     test.'skip'()
 .end
 
+=item C<skip_all( reason )>
+
+=cut
+
+.sub skip_all
+    .param string reason :optional
+
+    .local pmc test
+    get_hll_global test, [ 'Test'; 'More' ], '_test'
+    test.'skip_all'(reason)
+.end
+
 =item C<todo( passed, description, reason )>
 
 Records a test as pass or fail (like C<ok>, but marks it as TODO so it always


More information about the parrot-commits mailing list