baretest 0.4.0.pre2 → 0.4.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- data/MANIFEST.txt +1 -0
- data/README.rdoc +1 -6
- data/lib/baretest/assertion.rb +1 -1
- data/lib/baretest/run/cli.rb +14 -6
- data/lib/baretest/run.rb +10 -7
- data/lib/baretest/use/support.rb +9 -0
- data/lib/baretest/version.rb +1 -1
- data/test/suite/lib/baretest/assertion.rb +1 -1
- metadata +4 -3
data/MANIFEST.txt
CHANGED
data/README.rdoc
CHANGED
@@ -104,10 +104,7 @@ Usage:
|
|
104
104
|
|
105
105
|
== Planned Features
|
106
106
|
|
107
|
-
* Passing on flags/options for formatters
|
108
|
-
* Tagging tests to allow focusing (only run tests with/without specific tags)
|
109
107
|
* Word-wrapping for CLI runner
|
110
|
-
* Flags for color and verbose (\[no-]color and \[no-]verbose) for the executable
|
111
108
|
* baretest --init \[LAYOUT], to create the necessary directory structure
|
112
109
|
* Detect whether baretest is run from an interactive terminal or not and adjust
|
113
110
|
defaults (no-color e.g.)
|
@@ -124,8 +121,6 @@ Usage:
|
|
124
121
|
touched file
|
125
122
|
end
|
126
123
|
|
127
|
-
* Inline tests via Module#describe (basically the same as Test::Suite#suite)
|
128
|
-
* YARD code to extract the specifications without running the code
|
129
124
|
* A redmine plugin
|
130
125
|
* --fail-all flag, to test/review diagnostics of tests (no idea how to do that yet)
|
131
126
|
|
@@ -138,7 +133,7 @@ Usage:
|
|
138
133
|
|
139
134
|
== A Bit of Background
|
140
135
|
|
141
|
-
Originally,
|
136
|
+
Originally, baretest started out as a project for shits & giggles on the flight
|
142
137
|
back from vegas (railsconf09), to prove that it is possible to have a fully
|
143
138
|
fledged test-framework in under 100 lines of source-code.
|
144
139
|
Later I realized that this project could become more. For one it was (still is)
|
data/lib/baretest/assertion.rb
CHANGED
@@ -111,7 +111,7 @@ module BareTest
|
|
111
111
|
# containing suite.
|
112
112
|
def execute(with_setup=nil, and_teardown=nil)
|
113
113
|
if @skipped then
|
114
|
-
status = Status.new(self, :manually_skipped)
|
114
|
+
status = Status.new(self, :manually_skipped, nil, @skipped)
|
115
115
|
elsif !@block
|
116
116
|
status = Status.new(self, :pending)
|
117
117
|
else
|
data/lib/baretest/run/cli.rb
CHANGED
@@ -100,13 +100,17 @@ module BareTest
|
|
100
100
|
|
101
101
|
def run_suite(suite)
|
102
102
|
return super unless suite.description
|
103
|
+
|
104
|
+
indent = " #{' '*@depth}"
|
105
|
+
skip_reason = suite.reason(:indent => indent+' ', :first_indent => indent+' Reason: ')
|
106
|
+
|
103
107
|
case size = suite.assertions.size
|
104
108
|
when 0
|
105
|
-
defer "\n
|
109
|
+
defer "\n#{indent}\e[1m#{suite.description}\e[0m", skip_reason
|
106
110
|
when 1
|
107
|
-
defer "\n
|
111
|
+
defer "\n#{indent}\e[1m#{suite.description}\e[0m (1 test)", skip_reason
|
108
112
|
else
|
109
|
-
defer "\n
|
113
|
+
defer "\n#{indent}\e[1m#{suite.description}\e[0m (#{size} tests)", skip_reason
|
110
114
|
end
|
111
115
|
@depth += 1
|
112
116
|
rv = super(suite) # run the suite
|
@@ -121,7 +125,7 @@ module BareTest
|
|
121
125
|
rv = super # run the assertion
|
122
126
|
indent = ' '+' '*@depth
|
123
127
|
backtrace = []
|
124
|
-
reason = rv.reason(:indent => indent)
|
128
|
+
reason = rv.reason(:indent => indent, :first_indent => indent+'Reason: ')
|
125
129
|
|
126
130
|
printf(Formats[rv.status], StatusLabel[rv.status], ' '*@depth, interpolated_description(assertion, setup))
|
127
131
|
if rv.status == :error then
|
@@ -139,8 +143,12 @@ module BareTest
|
|
139
143
|
str.scan(/[^ ]+ /)
|
140
144
|
end
|
141
145
|
|
142
|
-
|
143
|
-
|
146
|
+
# Add data to output, but mark it as deferred
|
147
|
+
# We defer in order to be able to ignore suites. Ignored suites that
|
148
|
+
# contain unignored suites/assertions must be displayed, ignored suites
|
149
|
+
# that don't, will be popped from the deferred-stack
|
150
|
+
def defer(*output)
|
151
|
+
@deferred.concat(output.compact)
|
144
152
|
end
|
145
153
|
|
146
154
|
def pop_deferred
|
data/lib/baretest/run.rb
CHANGED
@@ -68,18 +68,21 @@ module BareTest
|
|
68
68
|
@exclude_tags = @options[:exclude_tags] # nil is ok here
|
69
69
|
include_states = @options[:include_states] # nil is ok here
|
70
70
|
exclude_states = @options[:exclude_states] # nil is ok here
|
71
|
-
@states = [nil,
|
71
|
+
@states = [nil, *BareTest::StatusOrder]
|
72
72
|
@skipped = {}
|
73
73
|
@last_run_states = {}
|
74
|
-
|
75
|
-
@persistence = @options[:persistence]
|
74
|
+
@persistence = @options[:persistence]
|
76
75
|
|
77
76
|
if (include_states || exclude_states) && !((include_states && include_states.empty?) && (exclude_states && exclude_states.empty?)) then
|
78
77
|
[include_states, exclude_states].compact.each do |states|
|
79
78
|
states << nil if states.include?(:new)
|
80
|
-
states
|
81
|
-
states.concat([:error, :skipped, :pending]) if states.include?(:failure)
|
79
|
+
states.push(:error, :skipped, :pending) if states.include?(:failure)
|
82
80
|
states.delete(:new)
|
81
|
+
if states.include?(:skipped) then
|
82
|
+
states.delete(:skipped)
|
83
|
+
states.push(:pending, :manually_skipped, :dependency_missing, :library_missing, :component_missing)
|
84
|
+
end
|
85
|
+
states.uniq!
|
83
86
|
end
|
84
87
|
@states = (include_states || @states) - (exclude_states || [])
|
85
88
|
end
|
@@ -144,9 +147,9 @@ module BareTest
|
|
144
147
|
skipped = @skipped[suite] || recursively_skipped
|
145
148
|
|
146
149
|
if recursively_skipped then
|
147
|
-
skip_recursively(suite, "
|
150
|
+
skip_recursively(suite, "Ancestor was skipped")
|
148
151
|
elsif skipped then
|
149
|
-
skip_suite(suite, "
|
152
|
+
skip_suite(suite, "Container was skipped")
|
150
153
|
end
|
151
154
|
end
|
152
155
|
|
data/lib/baretest/version.rb
CHANGED
@@ -145,7 +145,7 @@ BareTest.suite 'BareTest' do
|
|
145
145
|
|
146
146
|
suite '#setup' do
|
147
147
|
assert 'Fails if setup raises an exception' do
|
148
|
-
setup =
|
148
|
+
setup = BareTest::Setup.new do raise 'Some error' end
|
149
149
|
assertion = ::BareTest::Assertion.new(nil, 'assertion') do true end
|
150
150
|
status = assertion.execute([setup])
|
151
151
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baretest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.0.
|
4
|
+
version: 0.4.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Rusterholz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-24 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/baretest/use/mocha.rb
|
73
73
|
- lib/baretest/use/rack_test.rb
|
74
74
|
- lib/baretest/use/rr.rb
|
75
|
+
- lib/baretest/use/support.rb
|
75
76
|
- lib/baretest/version.rb
|
76
77
|
- lib/command.rb
|
77
78
|
- lib/command/argument.rb
|
@@ -118,7 +119,7 @@ rdoc_options:
|
|
118
119
|
- --tab-width
|
119
120
|
- "2"
|
120
121
|
- -t
|
121
|
-
- baretest-0.4.0.
|
122
|
+
- baretest-0.4.0.pre3
|
122
123
|
require_paths:
|
123
124
|
- lib
|
124
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|