tapout 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ require 'tapout/version'
2
+ require 'tapout/tap_legacy_adapter'
3
+ require 'tapout/reporters'
4
+
5
+ module TapOut
6
+
7
+ # The TAPLegacy Parser takes a traditional TAP stream and routes
8
+ # it through a Tap Out report format.
9
+ class TAPLegacyParser
10
+
11
+ # options[:format] - the report format to use
12
+ def initialize(options={})
13
+ format = options[:format] || 'dotprogress'
14
+ @reporter = Reporters.factory(format).new
15
+ end
16
+
17
+ # input - any object that responds to #gets
18
+ def consume(input)
19
+ parser = TAPLegacyAdapter.new(input)
20
+ parser | @reporter
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,58 @@
1
+ require 'tapout/reporters'
2
+
3
+ require 'yaml'
4
+
5
+ module TapOut
6
+
7
+ # The TAP-Y Parser takes a TAP-Y stream and routes it through
8
+ # a Tap Out report format.
9
+ class TAPYParser
10
+
11
+ #
12
+ def initialize(options={})
13
+ format = options[:format] || 'dotprogress'
14
+ @reporter = Reporters.factory(format).new
15
+ @doc = ''
16
+ @done = false
17
+ end
18
+
19
+ #
20
+ def consume(input)
21
+ @doc = ''
22
+ @done = false
23
+ while line = input.gets
24
+ self << line
25
+ end
26
+ handle unless @done # in case `...` was left out
27
+ end
28
+
29
+ # TODO: write this as a YAML stream parser
30
+ def <<(line)
31
+ case line
32
+ when /^\-\-\-/
33
+ handle #@doc
34
+ @doc << line
35
+ when /^\.\.\./
36
+ handle #@doc
37
+ stop
38
+ else
39
+ @doc << line
40
+ end
41
+ end
42
+
43
+ #
44
+ def handle
45
+ return if @doc == ''
46
+ entry = YAML.load(@doc)
47
+ @reporter << entry
48
+ @doc = ''
49
+ end
50
+
51
+ #
52
+ def stop
53
+ @done = true
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -0,0 +1,7 @@
1
+ module TapOut
2
+ #
3
+ VERSION = "1.0.0"
4
+
5
+ #
6
+ TAP_Y_VERSION = "1"
7
+ end
@@ -0,0 +1,5 @@
1
+ require 'stringio'
2
+
3
+ When 'Given a legacy TAP stream' do |text|
4
+ @tap = text
5
+ end
@@ -0,0 +1,68 @@
1
+ = TAP Parser
2
+
3
+ require 'tapout'
4
+
5
+ Given a legacy TAP stream:
6
+
7
+ 1..3
8
+ ok 1 - Example A
9
+ not ok 2 - Example B
10
+ ---
11
+ file: foo.rb
12
+ line: 45
13
+ description: this is that
14
+ found: this
15
+ wanted: that
16
+ raw_test: assert_equal('that', 'this')
17
+ extensions:
18
+ THAC0: 16
19
+ ...
20
+ ok 3
21
+
22
+ The TAPAdapter can convert the stream into TAP-Y.
23
+
24
+ stream = StringIO.new(@tap)
25
+
26
+ adapter = TapOut::TAPLegacyAdapter.new(stream)
27
+
28
+ entries = adapter.to_a
29
+
30
+ Once converted, there should five entries --a header and footer, two
31
+ passing tests and one failing test.
32
+
33
+ entries.size.assert == 5
34
+
35
+ Or pipe the converted stream directly to another stream.
36
+
37
+ stream = StringIO.new(@tap)
38
+
39
+ adapter = TapOut::TAPLegacyAdapter.new(stream)
40
+
41
+ output = ""
42
+
43
+ tapy = adapter | output
44
+
45
+ Given a legacy TAP stream:
46
+
47
+ 1..5
48
+ # test by equality
49
+ ok 1 - pass-thru 1
50
+ ok 2 - pass-thru 2
51
+ ok 3 - pass-thru 3
52
+ ok 4 - pass-thru 4
53
+ ok 5 - pass-thru 5
54
+ 1..5
55
+
56
+ Let's see if this works.
57
+
58
+ stream = StringIO.new(@tap)
59
+
60
+ adapter = TapOut::TAPLegacyAdapter.new(stream)
61
+
62
+ entries = adapter.to_a
63
+
64
+ Once converted, there should eight entries --a header and footer, one note
65
+ and five passing tests.
66
+
67
+ entries.size.assert == 8
68
+
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tapout
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Thomas Sawyer
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-21 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: ansi
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: redline
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :development
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: qed
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ type: :development
61
+ version_requirements: *id003
62
+ description: Tap Out is a TAP consumer that can take any TAP, TAP-Y or TAP-J stream and output it in a variety of useful formats.
63
+ email: transfire@gmail.com
64
+ executables:
65
+ - tapout
66
+ extensions: []
67
+
68
+ extra_rdoc_files:
69
+ - README.rdoc
70
+ files:
71
+ - .ruby
72
+ - bin/tapout
73
+ - lib/tapout/reporters/abstract.rb
74
+ - lib/tapout/reporters/breakdown.rb
75
+ - lib/tapout/reporters/dotprogress.rb
76
+ - lib/tapout/reporters/progressbar.rb
77
+ - lib/tapout/reporters/tap.rb
78
+ - lib/tapout/reporters/verbose.rb
79
+ - lib/tapout/reporters.rb
80
+ - lib/tapout/tap_legacy_adapter.rb
81
+ - lib/tapout/tap_legacy_parser.rb
82
+ - lib/tapout/tapy_parser.rb
83
+ - lib/tapout/version.rb
84
+ - lib/tapout.rb
85
+ - qed/applique/env.rb
86
+ - qed/tap_adapter.rdoc
87
+ - HISTORY.rdoc
88
+ - APACHE2.txt
89
+ - README.rdoc
90
+ - TAP-YJ.rdoc
91
+ - NOTICE.rdoc
92
+ homepage: http://rubyworks.github.com/tapout
93
+ licenses:
94
+ - Apache 2.0
95
+ post_install_message:
96
+ rdoc_options:
97
+ - --title
98
+ - Tap Out API
99
+ - --main
100
+ - README.rdoc
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
121
+ requirements: []
122
+
123
+ rubyforge_project: tapout
124
+ rubygems_version: 1.8.2
125
+ signing_key:
126
+ specification_version: 3
127
+ summary: Progressive TAP Harness
128
+ test_files: []
129
+