tapout 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/.ruby +12 -3
  2. data/.yardopts +6 -5
  3. data/HISTORY.rdoc +16 -0
  4. data/README.rdoc +18 -16
  5. data/TAP-YJ.md +15 -15
  6. data/bin/tapout +1 -1
  7. data/demo/applique/ae.rb +1 -0
  8. data/{spec → demo}/applique/env.rb +0 -0
  9. data/{spec → demo}/issues/applique/env.rb +0 -0
  10. data/{spec → demo}/issues/default_reporter.rdoc +2 -2
  11. data/{spec → demo}/perl_adapter.rdoc +3 -3
  12. data/{spec → demo}/reporters/applique/cli.rb +1 -1
  13. data/{spec → demo}/reporters/fixtures/tapy.yml +0 -0
  14. data/{spec → demo}/reporters/reporters.rdoc +0 -0
  15. data/lib/tapout.rb +5 -101
  16. data/lib/tapout.yml +12 -3
  17. data/lib/tapout/adapters/perl.rb +1 -1
  18. data/lib/tapout/cli.rb +98 -0
  19. data/lib/tapout/config.rb +103 -0
  20. data/lib/tapout/parsers/json.rb +2 -2
  21. data/lib/tapout/parsers/perl.rb +1 -1
  22. data/lib/tapout/parsers/yaml.rb +3 -2
  23. data/lib/tapout/reporters.rb +2 -1
  24. data/lib/tapout/reporters/abstract.rb +223 -31
  25. data/lib/tapout/reporters/breakdown_reporter.rb +49 -57
  26. data/lib/tapout/reporters/dot_reporter.rb +52 -33
  27. data/lib/tapout/reporters/html_reporter.rb +3 -1
  28. data/lib/tapout/reporters/markdown_reporter.rb +101 -0
  29. data/lib/tapout/reporters/outline_reporter.rb +68 -25
  30. data/lib/tapout/reporters/pretty_reporter.rb +65 -86
  31. data/lib/tapout/reporters/progress_reporter.rb +47 -22
  32. data/lib/tapout/reporters/runtime_reporter.rb +223 -0
  33. data/lib/tapout/reporters/tap_reporter.rb +1 -1
  34. data/lib/tapout/reporters/turn_reporter.rb +26 -65
  35. data/lib/tapout/version.rb +2 -2
  36. metadata +34 -19
  37. data/test/unit/test-progressbar.rb +0 -5
data/.ruby CHANGED
@@ -21,6 +21,10 @@ requirements:
21
21
  groups:
22
22
  - test
23
23
  development: true
24
+ - name: ae
25
+ groups:
26
+ - test
27
+ development: true
24
28
  dependencies: []
25
29
  conflicts: []
26
30
  repositories:
@@ -29,17 +33,22 @@ repositories:
29
33
  name: upstream
30
34
  resources:
31
35
  home: http://rubyworks.github.com/tapout
36
+ wiki: http://github.com/rubyworks/tapout/wiki
37
+ docs: http://rubydoc.info/gems/tapout/frames
32
38
  code: http://github.com/rubyworks/tapout
39
+ bugs: http://github.com/rubyworks/tapout/issues
40
+ mail: http://groups.google.com/rubyworks-mailinglist
41
+ chat: irc://chat.us.freenode.net#rubyworks
33
42
  extra: {}
34
43
  load_path:
35
44
  - lib
36
45
  revision: 0
37
46
  created: '2010-12-23'
38
47
  summary: Progressive TAP Harness
39
- title: TapOut
40
- version: 0.3.2
48
+ title: TAPOUT
49
+ version: 0.4.0
41
50
  name: tapout
42
51
  description: Tapout is a TAP consumer that can take any TAP, TAP-Y or TAP-J stream
43
52
  and output it in a variety of useful formats.
44
53
  organization: RubyWorks
45
- date: '2011-11-08'
54
+ date: '2012-02-01'
data/.yardopts CHANGED
@@ -1,7 +1,8 @@
1
- --title "Tap Out"
1
+ --title "TAPout"
2
2
  --readme README.rdoc
3
- --output-dir site/doc
3
+ --protected
4
4
  --private
5
- lib/**/*.rb -
6
- [A-Z][A-Z]*
7
-
5
+ lib
6
+ -
7
+ [A-Z]*.*
8
+ TAP-YJ.md
@@ -1,5 +1,21 @@
1
1
  = RELEASE HISTORY
2
2
 
3
+ == 0.4.0 / 2012-02-01
4
+
5
+ TAP-Y/J spec now supports `stdout` and `stderr` fields. This allows test
6
+ frameworks to capture stdout and stderr while running tests and pipe them
7
+ through with the TAP stream, which tapout can then include in the test
8
+ report output. This release also brings a great deal of improvement to test
9
+ reports in general, from better time stats to much improved backtrace output.
10
+
11
+ Changes:
12
+
13
+ * Rename namespace to Tapout, instead of TapOut.
14
+ * Add support for `stdout` and `stderr` fields to spec.
15
+ * Add common config for all reporters.
16
+ * Add common code snippet functionality to all reporters.
17
+ * Add markdown reporter.
18
+
3
19
 
4
20
  == 0.3.2 / 2011-11-08
5
21
 
@@ -1,6 +1,7 @@
1
- = Tap Out
1
+ = TAPOUT
2
2
 
3
3
  {Website}[http://rubyworks.github.com/tapout] |
4
+ {User Guide}[http://github.com/rubyworks/tapout/wiki] |
4
5
  {Development}[http://github.com/rubyworks/tapout] |
5
6
  {Report Issue}[http://github.com/rubyworks/tapout/issues]
6
7
 
@@ -9,15 +10,16 @@
9
10
 
10
11
  == DESCRIPTION
11
12
 
12
- TapOut is a TAP handler. TapOut supports TAP-Y/J as well as traditional TAP.
13
-
13
+ *TAPOUT* is a TAP handler which supports TAP-Y/J as well as traditional TAP streams.
14
14
  TAP-Y/J is a modernization of TAP using pure YAML/JSON streams.
15
+
15
16
  Traditional TAP has less detail than TAP-Y/J, but it can still be translated
16
- with fairly good results. TapOut includes a TAP adapter to handle the
17
- translation transparently. Currently TapOut supports TAP v12 with minor
18
- some limitations.
17
+ with fairly good results. TAPOUT includes a TAP adapter to handle the
18
+ translation transparently. Currently TAPOUT supports TAP v12 with some minor
19
+ limitations.
19
20
 
20
- To learn about the TAP-Y/J specification, see the {TAP-YJ.rdoc} file.
21
+ To learn about the TAP-Y/J specification, see the {TAP-Y/J Specification}[https://github.com/rubyworks/tapout/wiki/Specification]
22
+ document.
21
23
 
22
24
  For information about TAP, see http://testanything.org/wiki/index.php/Main_Page.
23
25
 
@@ -27,17 +29,17 @@ For information about TAP, see http://testanything.org/wiki/index.php/Main_Page.
27
29
  Using a test framework that produces a TAP-Y output stream, simply pipe
28
30
  the stream into `tapout`.
29
31
 
30
- $ ruby-test -y -Ilib test/foo.rb | tapout
32
+ $ rubytest -y -Ilib test/foo.rb | tapout
31
33
 
32
- TapOut supports a variety of output formats. These are selectable via the
34
+ TAPOUT supports a variety of output formats. These are selectable via the
33
35
  first argument. The default if not given, as in the example above, is `dotprogress`.
34
36
 
35
- $ ruby-test -y -Ilib test/foo.rb | tapout progessbar
37
+ $ rubytest -y -Ilib test/foo.rb | tapout progessbar
36
38
 
37
- TapOut is smart enough to match the closest matching format name. So, for
39
+ TAPOUT is smart enough to match the closest matching format name. So, for
38
40
  example, the above could be written as:
39
41
 
40
- $ ruby-test -y -Ilib test/foo.rb | tapout pro
42
+ $ rubytest -y -Ilib test/foo.rb | tapout pro
41
43
 
42
44
  And tapout will know to use the `progressbar` format.
43
45
 
@@ -46,16 +48,16 @@ To see a list of supported formats use the list subcommand:
46
48
  $ tapout --help
47
49
 
48
50
  If your test framework does not support TAP-Y, but does support traditional
49
- TAP, TapOut will automatically recognize the difference by TAP's `1..N` header.
51
+ TAP, TAPOUT will automatically recognize the difference by TAP's `1..N` header.
50
52
 
51
- $ ruby-test -ftap -Ilib test/foo.rb | tapout progressbar
53
+ $ rubytest -ftap -Ilib test/foo.rb | tapout progressbar
52
54
 
53
55
 
54
56
  == COPYRIGHTS
55
57
 
56
- TapOut - Copyright (c) 2010 Rubyworks
58
+ TAPOUT - Copyright (c) 2010 Rubyworks
57
59
 
58
- TapOut is licensed under the terms of the *BSD-2-Clause* license.
60
+ TAPOUT is distributable in accordance with the *BSD-2-Clause* license.
59
61
 
60
62
  See COPYING.rdoc for details.
61
63
 
data/TAP-YJ.md CHANGED
@@ -214,10 +214,10 @@ The `note` type is used to interject a message between tests that
214
214
  is not tied to a specific unit or case. It has only a few fields.
215
215
 
216
216
 
217
- ---
218
- type: note
219
- text:
220
- This is an example note.
217
+ ---
218
+ type: note
219
+ text:
220
+ This is an example note.
221
221
 
222
222
 
223
223
  The note document is simply used to interject any information the
@@ -233,17 +233,17 @@ stream. The `final` entry on the other hand incidates the end of a test suite,
233
233
  which will be followed by an end-document-marker (`...`).
234
234
 
235
235
 
236
- ---
237
- type : final
238
- time : 0.03
239
- counts:
240
- total: 2
241
- pass : 1
242
- fail : 1
243
- error: 0
244
- omit : 0
245
- todo : 0
246
- ...
236
+ ---
237
+ type : final
238
+ time : 0.03
239
+ counts:
240
+ total: 2
241
+ pass : 1
242
+ fail : 1
243
+ error: 0
244
+ omit : 0
245
+ todo : 0
246
+ ...
247
247
 
248
248
 
249
249
  A tally/final document MUST provide a counts mapping with the `total` number of
data/bin/tapout CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'tapout'
3
- TapOut.cli(*ARGV)
3
+ Tapout.cli(*ARGV)
@@ -0,0 +1 @@
1
+ require 'ae'
File without changes
File without changes
@@ -30,7 +30,7 @@ Instead of having each parser worry about setting the default
30
30
  we can let the factory method do it when `nil` is passed as an
31
31
  argument.
32
32
 
33
- reporter = TapOut::Reporters.factory(nil)
33
+ reporter = Tapout::Reporters.factory(nil)
34
34
 
35
- reporter #=> TapOut::Reporters::DotReporter
35
+ reporter #=> Tapout::Reporters::DotReporter
36
36
 
@@ -23,7 +23,7 @@ The PerlAdapter can convert the stream into TAP-Y.
23
23
 
24
24
  stream = StringIO.new(@tap)
25
25
 
26
- adapter = TapOut::PerlAdapter.new(stream)
26
+ adapter = Tapout::PerlAdapter.new(stream)
27
27
 
28
28
  entries = adapter.to_a
29
29
 
@@ -36,7 +36,7 @@ Or pipe the converted stream directly to another stream.
36
36
 
37
37
  stream = StringIO.new(@tap)
38
38
 
39
- adapter = TapOut::PerlAdapter.new(stream)
39
+ adapter = Tapout::PerlAdapter.new(stream)
40
40
 
41
41
  output = ""
42
42
 
@@ -57,7 +57,7 @@ Let's see if this works.
57
57
 
58
58
  stream = StringIO.new(@tap)
59
59
 
60
- adapter = TapOut::PerlAdapter.new(stream)
60
+ adapter = Tapout::PerlAdapter.new(stream)
61
61
 
62
62
  entries = adapter.to_a
63
63
 
@@ -8,6 +8,6 @@ When '(((\w+))) reporter should run without error' do |format|
8
8
  $stdin = StringIO.new(@tapy)
9
9
  $stdout = StringIO.new(out = '')
10
10
 
11
- TapOut.cli(format)
11
+ Tapout.cli(format)
12
12
  end
13
13
 
File without changes
@@ -1,104 +1,8 @@
1
- require 'optparse'
2
- require 'tapout/parsers'
3
-
4
- module TapOut
5
-
6
- # Default trace depth.
7
- @trace = nil
8
-
9
- #
10
- def self.trace
11
- @trace
12
- end
13
-
14
- #
15
- def self.trace=(depth)
16
- @trace = depth.to_i
17
- end
18
-
19
- # Command line interface.
20
- #
21
- def self.cli(*argv)
22
- options = {}
23
- type = :modern
24
-
25
- parser = OptionParser.new do |opt|
26
- opt.banner = "tapout [options] [reporter]"
27
-
28
- opt.separator("\nOPTIONS:")
29
-
30
- #opt.on('-t', '--tap', 'Consume legacy TAP input') do |fmt|
31
- # type = :legacy
32
- #end
33
-
34
- opt.on('--trace', '-t DEPTH', 'set backtrace depth') do |depth|
35
- self.trace = depth
36
- end
37
-
38
- opt.on('--no-color', 'Supress ANSI color codes') do
39
- $ansi = false # TODO: Is this correct?
40
- end
41
1
 
42
- opt.on('--debug', 'Run with $DEBUG flag on') do |fmt|
43
- $DEBUG = true
44
- end
45
-
46
- opt.separator("\nREPORTERS:\n " + Reporters.index.keys.join("\n "))
47
- end
48
-
49
- parser.parse!(argv)
50
-
51
- options[:format] = argv.first
52
-
53
- # TODO: would be nice if it could automatically determine which
54
- #c = $stdin.getc
55
- # $stdin.pos = 0
56
- #type = :legacy if c =~ /\d/
57
- #type = :modern if c == '-'
58
-
59
- stdin = Curmudgeon.new($stdin)
60
-
61
- case stdin.line1
62
- when /^\d/
63
- type = :perl
64
- when /^\-/
65
- type = :yaml
66
- when /^\{/
67
- type = :json
68
- else
69
- raise "Not a recognized TAP stream!"
70
- end
71
-
72
- case type
73
- when :perl
74
- stream_parser = PerlParser.new(options)
75
- exit_code = stream_parser.consume(stdin)
76
- when :yaml
77
- stream_parser = YamlParser.new(options)
78
- exit_code = stream_parser.consume(stdin)
79
- when :json
80
- stream_parser = JsonParser.new(options)
81
- exit_code = stream_parser.consume(stdin)
82
- end
83
-
84
- exit(exit_code || 0)
85
- end
2
+ module Tapout
3
+ end
86
4
 
87
- #
88
- class Curmudgeon #< IO
89
- def initialize(input)
90
- @input = input
91
- @line1 = input.gets
92
- end
93
- def line1
94
- @line1
95
- end
96
- def gets
97
- (class << self; self; end).class_eval %{
98
- def gets; @input.gets; end
99
- }
100
- return @line1
101
- end
102
- end
5
+ require 'tapout/config'
6
+ require 'tapout/cli'
7
+ require 'tapout/parsers'
103
8
 
104
- end
@@ -21,6 +21,10 @@ requirements:
21
21
  groups:
22
22
  - test
23
23
  development: true
24
+ - name: ae
25
+ groups:
26
+ - test
27
+ development: true
24
28
  dependencies: []
25
29
  conflicts: []
26
30
  repositories:
@@ -29,17 +33,22 @@ repositories:
29
33
  name: upstream
30
34
  resources:
31
35
  home: http://rubyworks.github.com/tapout
36
+ wiki: http://github.com/rubyworks/tapout/wiki
37
+ docs: http://rubydoc.info/gems/tapout/frames
32
38
  code: http://github.com/rubyworks/tapout
39
+ bugs: http://github.com/rubyworks/tapout/issues
40
+ mail: http://groups.google.com/rubyworks-mailinglist
41
+ chat: irc://chat.us.freenode.net#rubyworks
33
42
  extra: {}
34
43
  load_path:
35
44
  - lib
36
45
  revision: 0
37
46
  created: '2010-12-23'
38
47
  summary: Progressive TAP Harness
39
- title: TapOut
40
- version: 0.3.2
48
+ title: TAPOUT
49
+ version: 0.4.0
41
50
  name: tapout
42
51
  description: Tapout is a TAP consumer that can take any TAP, TAP-Y or TAP-J stream
43
52
  and output it in a variety of useful formats.
44
53
  organization: RubyWorks
45
- date: '2011-11-08'
54
+ date: '2012-02-01'
@@ -1,6 +1,6 @@
1
1
  require 'tapout/version'
2
2
 
3
- module TapOut
3
+ module Tapout
4
4
 
5
5
  # The TAP Legacy Adapter transforms traditional TAP format to
6
6
  # modern TAP-Y format.
@@ -0,0 +1,98 @@
1
+ module Tapout
2
+
3
+ require 'optparse'
4
+
5
+ # Command line interface.
6
+ #
7
+ def self.cli(*argv)
8
+ options = {}
9
+ type = :modern
10
+
11
+ parser = OptionParser.new do |opt|
12
+ opt.banner = "tapout [options] [reporter]"
13
+
14
+ opt.separator("\nOPTIONS:")
15
+
16
+ #opt.on('-t', '--tap', 'Consume legacy TAP input') do |fmt|
17
+ # type = :legacy
18
+ #end
19
+
20
+ opt.on('--trace', '-t DEPTH', 'set backtrace depth') do |depth|
21
+ self.config.trace = depth
22
+ end
23
+
24
+ opt.on('--lines', '-l LINES', 'number of surrounding source code lines') do |lines|
25
+ self.config.lines = lines.to_i
26
+ end
27
+
28
+ opt.on('--minimal', '-m', 'show only errors, failures and pending tests') do |val|
29
+ self.config.minimal = val
30
+ end
31
+
32
+ opt.on('--no-color', 'Supress ANSI color codes') do
33
+ $ansi = false
34
+ end
35
+
36
+ opt.on('--debug', 'Run with $DEBUG flag on') do |fmt|
37
+ $DEBUG = true
38
+ end
39
+
40
+ opt.separator("\nREPORTERS:\n " + Reporters.index.keys.join("\n "))
41
+ end
42
+
43
+ parser.parse!(argv)
44
+
45
+ options[:format] = argv.first
46
+
47
+ # TODO: would be nice if it could automatically determine which
48
+ #c = $stdin.getc
49
+ # $stdin.pos = 0
50
+ #type = :legacy if c =~ /\d/
51
+ #type = :modern if c == '-'
52
+
53
+ stdin = Curmudgeon.new($stdin)
54
+
55
+ case stdin.line1
56
+ when /^\d/
57
+ type = :perl
58
+ when /^\-/
59
+ type = :yaml
60
+ when /^\{/
61
+ type = :json
62
+ else
63
+ raise "Not a recognized TAP stream!"
64
+ end
65
+
66
+ case type
67
+ when :perl
68
+ stream_parser = PerlParser.new(options)
69
+ exit_code = stream_parser.consume(stdin)
70
+ when :yaml
71
+ stream_parser = YamlParser.new(options)
72
+ exit_code = stream_parser.consume(stdin)
73
+ when :json
74
+ stream_parser = JsonParser.new(options)
75
+ exit_code = stream_parser.consume(stdin)
76
+ end
77
+
78
+ exit(exit_code || 0)
79
+ end
80
+
81
+ #
82
+ class Curmudgeon #< IO
83
+ def initialize(input)
84
+ @input = input
85
+ @line1 = input.gets
86
+ end
87
+ def line1
88
+ @line1
89
+ end
90
+ def gets
91
+ (class << self; self; end).class_eval %{
92
+ def gets; @input.gets; end
93
+ }
94
+ return @line1
95
+ end
96
+ end
97
+
98
+ end