[svn:parrot] r45671 - trunk/runtime/parrot/library/TAP
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Wed Apr 14 15:20:50 UTC 2010
Author: fperrad
Date: Wed Apr 14 15:20:49 2010
New Revision: 45671
URL: https://trac.parrot.org/parrot/changeset/45671
Log:
[TAP] minor refactor
Modified:
trunk/runtime/parrot/library/TAP/Formatter.pir
trunk/runtime/parrot/library/TAP/Parser.pir
Modified: trunk/runtime/parrot/library/TAP/Formatter.pir
==============================================================================
--- trunk/runtime/parrot/library/TAP/Formatter.pir Wed Apr 14 14:24:36 2010 (r45670)
+++ trunk/runtime/parrot/library/TAP/Formatter.pir Wed Apr 14 15:20:49 2010 (r45671)
@@ -163,8 +163,8 @@
.end
.sub '_output_success' :method
- .param string msg
- self.'_output'(msg)
+ .param pmc args :slurpy
+ self.'_output'(args :flat)
.end
@@ -254,8 +254,8 @@
exit = parser.'exit'()
unless exit goto L4
- $S0 = exit
- formatter.'_failure_output'("Dubious, test returned ", $S0, "\n")
+ $S1 = exit
+ formatter.'_failure_output'("Dubious, test returned ", $S1, "\n")
L4:
unless failed == 0 goto L5
@@ -393,8 +393,8 @@
formatter = getattribute self, 'formatter'
$I0 = isa result, ['TAP';'Parser';'Result';'Bailout']
unless $I0 goto L1
- $S0 = result.'bailout'()
- formatter.'_failure_output'("Bailout called. Further testing stopped: ", $S0, "\n")
+ $S1 = result.'bailout'()
+ formatter.'_failure_output'("Bailout called. Further testing stopped: ", $S1, "\n")
L1:
$I0 = formatter.'really_quiet'()
@@ -433,9 +433,9 @@
pretty = formatter.'_format_name'(name)
.local pmc number
number = getattribute result, 'test_num'
- $S0 = number
- $S1 = plan
- formatter.'_output'("\r", pretty, $S0, $S1)
+ $S1 = number
+ $S2 = plan
+ formatter.'_output'("\r", pretty, $S1, $S2)
set last_status_printed, now
L5:
@@ -480,8 +480,8 @@
skip_all = getattribute parser, 'skip_all'
if null skip_all goto L3
unless skip_all goto L3
- $S0 = skip_all
- formatter.'_output'("skipped: ", $S0, "\n")
+ $S1 = skip_all
+ formatter.'_output'("skipped: ", $S1, "\n")
goto L1
L3:
$I0 = parser.'has_problems'()
@@ -491,6 +491,7 @@
L4:
.local string time_report
time_report = ''
+ # work in progress
formatter.'_output'("ok", time_report, "\n")
L1:
.end
Modified: trunk/runtime/parrot/library/TAP/Parser.pir
==============================================================================
--- trunk/runtime/parrot/library/TAP/Parser.pir Wed Apr 14 14:24:36 2010 (r45670)
+++ trunk/runtime/parrot/library/TAP/Parser.pir Wed Apr 14 15:20:49 2010 (r45671)
@@ -632,9 +632,10 @@
.end
.sub '_add_error' :method
- .param string error
+ .param pmc args :slurpy
$P0 = getattribute self, 'parse_errors'
- $P1 = box error
+ $S0 = join '', args
+ $P1 = box $S0
push $P0, $P1
.end
@@ -931,10 +932,8 @@
$I0 = self.'pragma'('strict')
unless $I0 goto L1
$P0 = getattribute result, 'raw'
- $S0 = $P0
- $S0 = 'Unknown TAP token: "' . $S0
- $S0 .= '"'
- self.'_add_error'($S0)
+ $S1 = $P0
+ self.'_add_error'('Unknown TAP token: "', $S1, '"')
L1:
.end
@@ -977,14 +976,9 @@
.local int number
number = $P0
unless number != tests_run goto L22
- $S0 = "Tests out of sequence. Found ("
$S1 = number
- $S0 .= $S1
- $S0 .= ") but expected ("
- $S1 = tests_run
- $S0 .= $S1
- $S0 .= ")"
- self.'_add_error'($S0)
+ $S2 = tests_run
+ self.'_add_error'("Tests out of sequence. Found (", $S1, ") but expected (", $S2, ")")
goto L22
L21:
number = tests_run
@@ -1048,10 +1042,8 @@
.sub '_GOT_PLAN_test' :method :nsentry
.param pmc result
$P0 = getattribute self, 'plan'
- $S0 = $P0
- $S0 = "Plan (" . $S0
- $S0 .= ") must be at the beginning or end of the TAP output"
- self.'_add_error'($S0)
+ $S1 = $P0
+ self.'_add_error'("Plan (", $S1, ") must be at the beginning or end of the TAP output")
self.'is_good_plan'(0)
.end
@@ -1083,14 +1075,9 @@
$P0 = box 0
setattribute self, 'good_plan', $P0
if tests_planned == 0 goto L4
- $S0 = "Bad plan. You planned "
$S1 = tests_planned
- $S0 .= $S1
- $S0 .= " tests but ran "
- $S1 = tests_run
- $S0 .= $S1
- $S0 .= "."
- self.'_add_error'($S0)
+ $S2 = tests_run
+ self.'_add_error'("Bad plan. You planned ", $S1, " tests but ran ", $S2, ".")
L4:
$P0 = getattribute self, 'good_plan'
More information about the parrot-commits
mailing list