[svn:parrot] r45861 - trunk/runtime/parrot/library/TAP

fperrad at svn.parrot.org fperrad at svn.parrot.org
Wed Apr 21 18:09:37 UTC 2010


Author: fperrad
Date: Wed Apr 21 18:09:36 2010
New Revision: 45861
URL: https://trac.parrot.org/parrot/changeset/45861

Log:
[TAP] add pod

Modified:
   trunk/runtime/parrot/library/TAP/Formatter.pir
   trunk/runtime/parrot/library/TAP/Harness.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 21 15:07:25 2010	(r45860)
+++ trunk/runtime/parrot/library/TAP/Formatter.pir	Wed Apr 21 18:09:36 2010	(r45861)
@@ -11,6 +11,12 @@
 
 See L<http://search.cpan.org/~andya/Test-Harness/>
 
+=head3 Class TAP;Formatter;Base
+
+Base class for harness output delegates
+
+=over 4
+
 =cut
 
 .namespace ['TAP';'Formatter';'Base']
@@ -31,6 +37,10 @@
     setattribute self, 'verbosity', $P0
 .end
 
+=item process_args
+
+=cut
+
 .sub 'process_args' :method
     .param pmc opts
     $I0 = exists opts['verbose']
@@ -74,6 +84,10 @@
   L7:
 .end
 
+=item verbose
+
+=cut
+
 .sub 'verbose' :method
     $P0 = getattribute self, 'verbosity'
     $I0 = $P0
@@ -81,6 +95,10 @@
     .return ($I0)
 .end
 
+=item quiet
+
+=cut
+
 .sub 'quiet' :method
     $P0 = getattribute self, 'verbosity'
     $I0 = $P0
@@ -88,6 +106,10 @@
     .return ($I0)
 .end
 
+=item really_quiet
+
+=cut
+
 .sub 'really_quiet' :method
     $P0 = getattribute self, 'verbosity'
     $I0 = $P0
@@ -95,6 +117,10 @@
     .return ($I0)
 .end
 
+=item silent
+
+=cut
+
 .sub 'silent' :method
     $P0 = getattribute self, 'verbosity'
     $I0 = $P0
@@ -102,6 +128,10 @@
     .return ($I0)
 .end
 
+=item prepare
+
+=cut
+
 .sub 'prepare' :method
     .param pmc tests
     .local int longest
@@ -119,6 +149,10 @@
     setattribute self, '_longest', $P0
 .end
 
+=item _format_name
+
+=cut
+
 .sub '_format_name' :method
     .param string name
     $P0 = getattribute self, '_longest'
@@ -137,6 +171,10 @@
     die "Unimplemented."
 .end
 
+=item summary
+
+=cut
+
 .sub 'summary' :method
     .param pmc aggregate
     $I0 = self.'silent'()
@@ -257,12 +295,20 @@
   L1:
 .end
 
+=item _output
+
+=cut
+
 .sub '_output' :method
     .param pmc args :slurpy
     $S0 = join '', args
     print $S0
 .end
 
+=item _failure_output
+
+=cut
+
 .sub '_failure_output' :method
     .param pmc args :slurpy
     self.'_output'(args :flat)
@@ -345,6 +391,15 @@
     .return (range)
 .end
 
+=back
+
+=head3 Class TAP;Formatter;Session
+
+Abstract base class for harness output delegate
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Formatter';'Session']
 
@@ -365,19 +420,35 @@
   L1:
 .end
 
+=item header
+
+=cut
+
 .sub 'header' :method
     # nothing
 .end
 
+=item result
+
+=cut
+
 .sub 'result' :method
     .param pmc result
     # nothing
 .end
 
+=item close_test
+
+=cut
+
 .sub 'close_test' :method
     # nothing
 .end
 
+=item clear_for_close
+
+=cut
+
 .sub 'clear_for_close' :method
     # nothing
 .end
@@ -483,6 +554,15 @@
   L1:
 .end
 
+=back
+
+=head3 Class TAP;Formatter;Console
+
+Harness output delegate for default console output
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Formatter';'Console']
 
@@ -490,6 +570,10 @@
     $P0 = subclass ['TAP';'Formatter';'Base'], ['TAP';'Formatter';'Console']
 .end
 
+=item open_test
+
+=cut
+
 .sub 'open_test' :method
     .param string test
     .param pmc parser
@@ -507,10 +591,18 @@
     .return ($P0)
 .end
 
+=item _set_colors
+
+=cut
+
 .sub '_set_colors' :method
     .param pmc colors :slurpy
 .end
 
+=item _output_success
+
+=cut
+
 .sub '_output_success' :method
     .param string msg
     self.'_set_colors'('green')
@@ -518,6 +610,10 @@
     self.'_set_colors'('reset')
 .end
 
+=item _failure_output
+
+=cut
+
 .sub '_failure_output' :method
     .param pmc args :slurpy
     self.'_set_colors'('red')
@@ -526,6 +622,15 @@
     self.'_set_colors'('reset')
 .end
 
+=back
+
+=head3 Class TAP;Formatter;Console;Session
+
+Harness output delegate for default console output
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Formatter';'Console';'Session']
 
@@ -548,6 +653,10 @@
     $P0(self)
 .end
 
+=item _get_output_result
+
+=cut
+
 .sub '_get_output_result' :method
     .param pmc result
     .local pmc formatter
@@ -556,6 +665,10 @@
     formatter.'_output'($S0)
 .end
 
+=item header
+
+=cut
+
 .sub 'header' :method
     .local pmc formatter
     formatter = getattribute self, 'formatter'
@@ -569,6 +682,10 @@
   L1:
 .end
 
+=item result
+
+=cut
+
 .sub 'result' :method
     .param pmc result
     .local pmc formatter
@@ -652,6 +769,10 @@
   L2:
 .end
 
+=item close_test
+
+=cut
+
 .sub 'close_test' :method
     .local pmc formatter
     formatter = getattribute self, 'formatter'
@@ -690,6 +811,10 @@
   L1:
 .end
 
+=item clear_for_close
+
+=cut
+
 .sub 'clear_for_close' :method
     .local pmc parser, formatter, name, plan, output
     .local string tests_run, pretty
@@ -711,6 +836,8 @@
     formatter.'_output'("\r", $S0)
 .end
 
+=back
+
 =head1 AUTHOR
 
 Francois Perrad

Modified: trunk/runtime/parrot/library/TAP/Harness.pir
==============================================================================
--- trunk/runtime/parrot/library/TAP/Harness.pir	Wed Apr 21 15:07:25 2010	(r45860)
+++ trunk/runtime/parrot/library/TAP/Harness.pir	Wed Apr 21 18:09:36 2010	(r45861)
@@ -13,6 +13,13 @@
 See L<http://search.cpan.org/~andya/Test-Harness/>
 end L<http://search.cpan.org/~wonko/TAP-Harness-Archive/>.
 
+=head3 Class TAP;Harness
+
+This is a simple test harness which allows tests to be run and results
+automatically aggregated and output to STDOUT.
+
+=over 4
+
 =cut
 
 .namespace ['TAP';'Harness']
@@ -43,6 +50,10 @@
     setattribute self, 'ok_callbacks', $P0
 .end
 
+=item process_args
+
+=cut
+
 .sub 'process_args' :method
     .param pmc opts
     setattribute self, 'opts', opts
@@ -68,11 +79,19 @@
   L3:
 .end
 
+=item formatter
+
+=cut
+
 .sub 'formatter' :method
     .param pmc formatter
     setattribute self, 'formatter', formatter
 .end
 
+=item runtests
+
+=cut
+
 .sub 'runtests' :method :nsentry
     .param pmc tests
     $P0 = getattribute self, 'formatter'
@@ -212,6 +231,19 @@
   L1:
 .end
 
+=back
+
+=head3 Class TAP';Harness;Archive
+
+This module is a direct subclass of C<TAP;Harness> and behaves
+in exactly the same way except for one detail. In addition to
+outputting a running progress of the tests and an ending summary
+it can also capture all of the raw TAP from the individual test
+files or streams into an archive file (C<.tar.gz>).
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Harness';'Archive']
 
@@ -223,11 +255,19 @@
     $P0.'add_attribute'('archive_extra_props')
 .end
 
+=item archive
+
+=cut
+
 .sub 'archive' :method
     .param pmc archive
     setattribute self, 'archive_file', archive
 .end
 
+=item extra_files
+
+=cut
+
 .sub 'extra_files' :method
     .param pmc extra_files
     $I0 = does extra_files, 'array'
@@ -237,6 +277,10 @@
     setattribute self, 'archive_extra_files', extra_files
 .end
 
+=item extra_props
+
+=cut
+
 .sub 'extra_props' :method
     .param pmc extra_props
     $I0 = does extra_props, 'hash'
@@ -246,6 +290,10 @@
     setattribute self, 'archive_extra_props', extra_props
 .end
 
+=item runtests
+
+=cut
+
 .sub 'runtests' :method
     .param pmc files
     $P0 = getattribute self, 'archive_file'
@@ -358,6 +406,7 @@
     .return ($S0)
 .end
 
+=back
 
 =head1 AUTHOR
 

Modified: trunk/runtime/parrot/library/TAP/Parser.pir
==============================================================================
--- trunk/runtime/parrot/library/TAP/Parser.pir	Wed Apr 21 15:07:25 2010	(r45860)
+++ trunk/runtime/parrot/library/TAP/Parser.pir	Wed Apr 21 18:09:36 2010	(r45861)
@@ -11,6 +11,12 @@
 
 See L<http://search.cpan.org/~andya/Test-Harness/>
 
+=head3 Class TAP;Parser;Result
+
+Base class for TAP::Parser output objects
+
+=over 4
+
 =cut
 
 .namespace ['TAP';'Parser';'Result']
@@ -22,12 +28,20 @@
     $P0.'add_attribute'('explanation')
 .end
 
+=item get_string
+
+=cut
+
 .sub 'get_string' :vtable :method
     $P0 = getattribute self, 'raw'
     $S0 = $P0
     .return ($S0)
 .end
 
+=item type
+
+=cut
+
 .sub 'type' :method
     $S0 = typeof self
     $P0 = split ';', $S0
@@ -36,6 +50,10 @@
     .return ($S0)
 .end
 
+=item has_todo
+
+=cut
+
 .sub 'has_todo' :method
     $P0 = getattribute self, 'directive'
     unless null $P0 goto L1
@@ -46,6 +64,10 @@
     .return ($I0)
 .end
 
+=item has_skip
+
+=cut
+
 .sub 'has_skip' :method
     $P0 = getattribute self, 'directive'
     unless null $P0 goto L1
@@ -56,6 +78,10 @@
     .return ($I0)
 .end
 
+=item has_directive
+
+=cut
+
 .sub 'has_directive' :method
     $I0 = self.'has_todo'()
     if $I0 goto L1
@@ -64,6 +90,13 @@
     .return ($I0)
 .end
 
+=back
+
+=head3 Class TAP;Parser;Result;Bailout
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Parser';'Result';'Bailout']
 
@@ -71,11 +104,20 @@
     $P0 = subclass ['TAP';'Parser';'Result'], ['TAP';'Parser';'Result';'Bailout']
 .end
 
+=item bailout
+
+=cut
+
 .sub 'bailout' :method
     $P0 = getattribute self, 'explanation'
     .return ($P0)
 .end
 
+=back
+
+=head3 Class TAP;Parser;Result;Comment
+
+=cut
 
 .namespace ['TAP';'Parser';'Result';'Comment']
 
@@ -84,6 +126,9 @@
     $P0.'add_attribute'('comment')
 .end
 
+=head3 Class TAP;Parser;Result;Plan
+
+=cut
 
 .namespace ['TAP';'Parser';'Result';'Plan']
 
@@ -93,6 +138,11 @@
     $P0.'add_attribute'('tests_planned')
 .end
 
+=head3 Class TAP;Parser;Result;Test
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Parser';'Result';'Test']
 
@@ -104,6 +154,10 @@
     $P0.'add_attribute'('unplanned')
 .end
 
+=item get_string
+
+=cut
+
 .sub 'get_string' :vtable :method
     $P0 = getattribute self, 'ok'
     $S0 = $P0
@@ -133,6 +187,10 @@
     .return ($S0)
 .end
 
+=item is_ok
+
+=cut
+
 .sub 'is_ok' :method
     $P0 = getattribute self, 'unplanned'
     if null $P0 goto L1
@@ -146,6 +204,10 @@
     .return ($I0)
 .end
 
+=item is_actual_ok
+
+=cut
+
 .sub 'is_actual_ok' :method
     $P0 = getattribute self, 'ok'
     $S0 = $P0
@@ -154,6 +216,10 @@
     .return ($I0)
 .end
 
+=item todo_passed
+
+=cut
+
 .sub 'todo_passed' :method
     $I0 = self.'has_todo'()
     unless $I0 goto L1
@@ -162,6 +228,10 @@
     .return ($I0)
 .end
 
+=item is_unplanned
+
+=cut
+
 .sub 'is_unplanned' :method
     $I0 = 0
     $P0 = getattribute self, 'unplanned'
@@ -171,6 +241,11 @@
     .return ($I0)
 .end
 
+=back
+
+=head3 Class TAP;Parser;Result;Unknown
+
+=cut
 
 .namespace ['TAP';'Parser';'Result';'Unknown']
 
@@ -178,6 +253,9 @@
     $P0 = subclass ['TAP';'Parser';'Result'], ['TAP';'Parser';'Result';'Unknown']
 .end
 
+=head3 Class TAP;Parser;Result;Version
+
+=cut
 
 .namespace ['TAP';'Parser';'Result';'Version']
 
@@ -186,6 +264,14 @@
     $P0.'add_attribute'('version')
 .end
 
+=head3 Class TAP;Parser;Grammar
+
+C<TAP;Parser;Grammar> tokenizes lines and constructs C<TAP;Parser;Result>
+subclasses to represent the tokens.
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Parser';'Grammar']
 
@@ -212,6 +298,10 @@
     .return (str)
 .end
 
+=item tokenize
+
+=cut
+
 .sub 'tokenize' :method
     .param string line
     .local pmc result
@@ -430,6 +520,16 @@
     .return (result)
 .end
 
+=back
+
+=head3 Class TAP;Base
+
+Base class that provides common functionality to C<TAP;Parser>
+and C<TAP;Harness> ie. callback support.
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Base']
 
@@ -439,6 +539,10 @@
     $P0.'add_attribute'('ok_callbacks')
 .end
 
+=item callback
+
+=cut
+
 .sub 'callback' :method
     .param string event
     .param pmc callback
@@ -458,6 +562,10 @@
     $P0[event] = callback
 .end
 
+=item _has_callback
+
+=cut
+
 .sub '_has_callback' :method
     $P0 = getattribute self, 'code_for'
     if null $P0 goto L1
@@ -466,6 +574,10 @@
     .return (0)
 .end
 
+=item _callback_for
+
+=cut
+
 .sub '_callback_for' :method
     .param string event
     null $P1
@@ -478,6 +590,10 @@
     .return ($P1)
 .end
 
+=item _make_callback
+
+=cut
+
 .sub '_make_callback' :method
     .param string event
     .param pmc args :slurpy
@@ -492,6 +608,15 @@
     .return ()
 .end
 
+=back
+
+=head3 Class TAP;Parser
+
+C<TAP;Parser> is designed to produce a proper parse of TAP output.
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Parser']
 
@@ -558,56 +683,100 @@
     setattribute self, 'ok_callbacks', $P0
 .end
 
+=item start_time
+
+=cut
+
 .sub 'start_time' :method
     $P0 = getattribute self, 'start_time'
     .return ($P0)
 .end
 
+=item end_time
+
+=cut
+
 .sub 'end_time' :method
     $P0 = getattribute self, 'end_time'
     .return ($P0)
 .end
 
+=item skipped
+
+=cut
+
 .sub 'skipped' :method :nsentry
     $P0 = getattribute self, 'skipped'
     .return ($P0)
 .end
 
+=item todo
+
+=cut
+
 .sub 'todo' :method :nsentry
     $P0 = getattribute self, 'todo'
     .return ($P0)
 .end
 
+=item passed
+
+=cut
+
 .sub 'passed' :method :nsentry
     $P0 = getattribute self, 'passed'
     .return ($P0)
 .end
 
+=item failed
+
+=cut
+
 .sub 'failed' :method :nsentry
     $P0 = getattribute self, 'failed'
     .return ($P0)
 .end
 
+=item todo_passed
+
+=cut
+
 .sub 'todo_passed' :method :nsentry
     $P0 = getattribute self, 'todo_passed'
     .return ($P0)
 .end
 
+=item parse_errors
+
+=cut
+
 .sub 'parse_errors' :method :nsentry
     $P0 = getattribute self, 'parse_errors'
     .return ($P0)
 .end
 
+=item tests_run
+
+=cut
+
 .sub 'tests_run' :method :nsentry
     $P0 = getattribute self, 'tests_run'
     .return ($P0)
 .end
 
+=item tests_planned
+
+=cut
+
 .sub 'tests_planned' :method :nsentry
     $P0 = getattribute self, 'tests_planned'
     .return ($P0)
 .end
 
+=item merge
+
+=cut
+
 .sub 'merge' :method :nsentry
     .param int val
     $P0 = new 'Boolean'
@@ -615,6 +784,10 @@
     setattribute self, 'merge', $P0
 .end
 
+=item ignore_exit
+
+=cut
+
 .sub 'ignore_exit' :method :nsentry
     .param int val
     $P0 = new 'Boolean'
@@ -622,6 +795,10 @@
     setattribute self, 'ignore_exit', $P0
 .end
 
+=item exit
+
+=cut
+
 .sub 'exit' :method :nsentry
     $P0 = getattribute self, 'ignore_exit'
     if null $P0 goto L1
@@ -636,6 +813,10 @@
     .return ($I0)
 .end
 
+=item has_problems
+
+=cut
+
 .sub 'has_problems' :method
     $P0 = getattribute self, 'failed'
     $I0 = elements $P0
@@ -655,6 +836,10 @@
     .return ($I0)
 .end
 
+=item _add_error
+
+=cut
+
 .sub '_add_error' :method
     .param pmc args :slurpy
     $P0 = getattribute self, 'parse_errors'
@@ -663,16 +848,28 @@
     push $P0, $P1
 .end
 
+=item is_good_plan
+
+=cut
+
 .sub 'is_good_plan' :method
     $P0 = getattribute self, 'good_plan'
     .return ($P0)
 .end
 
+=item spool
+
+=cut
+
 .sub 'spool' :method
     .param pmc spool
     setattribute self, 'spool', spool
 .end
 
+=item delete_spool
+
+=cut
+
 .sub 'delete_spool' :method
     $P0 = getattribute self, 'spool'
     null $P1
@@ -680,11 +877,19 @@
     .return ($P0)
 .end
 
+=item pragma
+
+=cut
+
 .sub 'pragma' :method
     .param string name
     .return (1)
 .end
 
+=item tap
+
+=cut
+
 .sub 'tap' :method
     .param string tap
     $P0 = new 'StringHandle'
@@ -693,6 +898,10 @@
     setattribute self, 'stream', $P0
 .end
 
+=item file
+
+=cut
+
 .sub 'file' :method
     .param string filename
     $P0 = new 'FileHandle'
@@ -739,6 +948,10 @@
     .return ($S0)
 .end
 
+=item exec
+
+=cut
+
 .sub 'exec' :method
     .param pmc cmds :slurpy
     .local string cmd
@@ -767,6 +980,10 @@
     rethrow ex
 .end
 
+=item run
+
+=cut
+
 .sub 'run' :method
     .const 'Sub' $P0 = 'next'
     $P0 = newclosure $P0
@@ -775,6 +992,10 @@
     unless null $P1 goto L1
 .end
 
+=item next
+
+=cut
+
 .sub 'next' :method :nsentry :lex
     .local pmc stream, spool
     stream = getattribute self, 'stream'
@@ -1126,6 +1347,16 @@
   L5:
 .end
 
+=back
+
+=head3 Class TAP;Parser;Aggregator
+
+C<TAP;Parser;Aggregator> collects parser objects and allows
+reporting/querying their aggregate results.
+
+=over 4
+
+=cut
 
 .namespace ['TAP';'Parser';'Aggregator']
 
@@ -1196,6 +1427,10 @@
   L2:
 .end
 
+=item add
+
+=cut
+
 .sub 'add' :method
     .param string description
     .param pmc parser
@@ -1233,6 +1468,10 @@
   L3:
 .end
 
+=item parsers
+
+=cut
+
 .sub 'parsers' :method
     .param string desc
     $P0 = getattribute self, 'parser_for'
@@ -1240,45 +1479,77 @@
     .return ($P1)
 .end
 
+=item total
+
+=cut
+
 .sub 'total' :method
     $P0 = getattribute self, 'total'
     $I0 = $P0
     .return ($I0)
 .end
 
+=item passed
+
+=cut
+
 .sub 'passed' :method
     $P0 = getattribute self, 'passed'
     $I0 = $P0
     .return ($I0)
 .end
 
+=item descriptions
+
+=cut
+
 .sub 'descriptions' :method
     $P0 = getattribute self, 'parse_order'
     .return ($P0)
 .end
 
+=item start
+
+=cut
+
 .sub 'start' :method
     $N0 = time
     $P0 = box $N0
     setattribute self, 'start_time', $P0
 .end
 
+=item stop
+
+=cut
+
 .sub 'stop' :method
     $N0 = time
     $P0 = box $N0
     setattribute self, 'end_time', $P0
 .end
 
+=item start_time
+
+=cut
+
 .sub 'start_time' :method
     $P0= getattribute self, 'start_time'
     .return ($P0)
 .end
 
+=item en_time
+
+=cut
+
 .sub 'end_time' :method
     $P0= getattribute self, 'end_time'
     .return ($P0)
 .end
 
+=item elapsed
+
+=cut
+
 .sub 'elapsed' :method
     $P0 = getattribute self, 'end_time'
     if null $P0 goto L1
@@ -1292,6 +1563,10 @@
     die "Can't call elapsed without first calling start and then stop"
 .end
 
+=item elapsed_timestr
+
+=cut
+
 .sub 'elapsed_timestr' :method
     $N0 = self.'elapsed'()
     $P0 = new 'FixedPMCArray'
@@ -1301,6 +1576,10 @@
     .return ($S0)
 .end
 
+=item has_problems
+
+=cut
+
 .sub 'has_problems' :method
     $P0 = getattribute self, 'todo_passed'
     $I0 = $P0
@@ -1310,6 +1589,10 @@
     .return ($I0)
 .end
 
+=item has_errors
+
+=cut
+
 .sub 'has_errors' :method
     $P0 = getattribute self, 'failed'
     $I0 = $P0
@@ -1323,6 +1606,10 @@
     .return ($I0)
 .end
 
+=item get_status
+
+=cut
+
 .sub 'get_status' :method
     .local int total, passed
     $P0 = getattribute self, 'total'
@@ -1341,6 +1628,10 @@
     .return ('NOTESTS')
 .end
 
+=item all_passed
+
+=cut
+
 .sub 'all_passed' :method
     .local int total
     $P0 = getattribute self, 'total'
@@ -1356,6 +1647,8 @@
     .return (0)
 .end
 
+=back
+
 =head1 AUTHOR
 
 Francois Perrad


More information about the parrot-commits mailing list