wrong 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +9 -8
- data/lib/wrong.rb +1 -1
- data/lib/wrong/adapters/rspec.rb +10 -1
- data/lib/wrong/chunk.rb +74 -9
- data/lib/wrong/version.rb +1 -1
- data/test/adapters/rspec1/failing_spec.rb +9 -0
- data/test/adapters/rspec2/failing_spec.rb +9 -0
- data/test/adapters/rspec_test.rb +1 -1
- data/test/chunk_test.rb +90 -8
- data/test/d_test.rb +3 -1
- data/test/failure_message_test.rb +1 -1
- metadata +243 -190
data/README.markdown
CHANGED
@@ -159,7 +159,7 @@ Here's an RSpec example:
|
|
159
159
|
|
160
160
|
describe BleuCheese do
|
161
161
|
it "stinks" do
|
162
|
-
|
162
|
+
expect { BleuCheese.new.smell > 9000 }
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
@@ -171,11 +171,11 @@ This makes your code read like a BDD-style DSL, without RSpec's arcane "should"
|
|
171
171
|
|
172
172
|
BleuCheese.new.smell.should > 9000
|
173
173
|
|
174
|
-
and seriously, tell me which one more clearly describes the desired behavior. The object under test doesn't really have a `should` method, so why should it during a test? And in what human language is "should greater than" a valid phrase?
|
174
|
+
and seriously, tell me which one more clearly describes the desired behavior. The object under test doesn't really have a `should` method, so why should it magically get one during a test? And in what human language is "should greater than" a valid phrase?
|
175
175
|
|
176
176
|
## Algorithm ##
|
177
177
|
|
178
|
-
So wait a second. How do we do it? Doesn't Ruby have [poor support for AST introspection](http://blog.zenspider.com/2009/04/parsetree-eol.html)? Well, yes, it does, so we cheat: we figure out what file and line the assert block is defined in, then open the file, read the code, and parse it directly using Ryan Davis' amazing [RubyParser](http://parsetree.rubyforge.org/ruby_parser/) and [Ruby2Ruby](http://seattlerb.rubyforge.org/ruby2ruby/). You can bask in the kludge by examining `chunk.rb` and `assert.rb`. If you find some code it can't parse, please send it our way.
|
178
|
+
So wait a second. How do we do it? Doesn't Ruby have [poor support for AST introspection](http://blog.zenspider.com/2009/04/parsetree-eol.html)? Well, yes, it does, so we cheat: we figure out what file and line the assert block is defined in, then open the file, read the code, and parse it directly using Ryan Davis' amazing [RubyParser](http://parsetree.rubyforge.org/ruby_parser/) and [Ruby2Ruby](http://seattlerb.rubyforge.org/ruby2ruby/). You can bask in the kludge by examining `chunk.rb` and `assert.rb`. If you find some code it can't parse, please send it our way. As a failsafe we also use Sourcify, which has yet another home baked RACC parser, so we have many chances to parse your code.
|
179
179
|
|
180
180
|
Before you get your knickers in a twist about how this is totally unacceptable because it doesn't support this or that use case, here are our caveats and excuses:
|
181
181
|
|
@@ -183,7 +183,7 @@ Before you get your knickers in a twist about how this is totally unacceptable b
|
|
183
183
|
* Your code needs to be in a file.
|
184
184
|
* If you're developing Ruby code without saving it to a mounted disk, then sorry, Wrong is not right for you.
|
185
185
|
* We monkey-patch IRB so if you do `irb -rwrong` it'll save off your session in memory where Wrong can read it.
|
186
|
-
* It'd be nice if it could work inside a `-e` block but as far as we can tell, there's no way to grab that `-e` code from inside Ruby.
|
186
|
+
* It'd be nice if it could work inside a `-e` block but as far as we can tell, there's no way to grab that `-e` source code from inside Ruby.
|
187
187
|
* It's a development-time testing library, not a production runtime library, so there are no security or filesystem issues.
|
188
188
|
* `eval` isn't evil, it's just misunderstood.
|
189
189
|
* It makes a few assumptions about the structure of your code, leading to some restrictions:
|
@@ -191,6 +191,7 @@ Before you get your knickers in a twist about how this is totally unacceptable b
|
|
191
191
|
* You can't use metaprogramming to write your assert blocks.
|
192
192
|
* All variables and methods must be available in the binding of the assert block.
|
193
193
|
* Passing a proc around and eventually calling assert on it might not work in some Ruby implementations.
|
194
|
+
* "Doesn't all this parsing slow down my test run"? No - this applies to failure cases only. If the assert block returns true then Wrong simply moves on.
|
194
195
|
|
195
196
|
## Adapters ##
|
196
197
|
|
@@ -210,7 +211,7 @@ To use these, put the appropriate `require` in your helper, **after** requiring
|
|
210
211
|
|
211
212
|
assert("since we're on Earth") { sky.blue? }
|
212
213
|
|
213
|
-
Since the point of Wrong is to make asserts self-explanatory, you should
|
214
|
+
Since the point of Wrong is to make asserts self-explanatory, you should use explanations only when they would add something that you couldn't get from reading the (failed) assertion code itself. Don't bother doing things like this:
|
214
215
|
|
215
216
|
assert("the sky should be blue") { sky.blue? } # redundant
|
216
217
|
|
@@ -231,13 +232,13 @@ When a failure occurs, the exception message contains all the details you might
|
|
231
232
|
* If there is a formatter registered for this type of predicate, its output will come next. (See below.)
|
232
233
|
* SUBEXP is each of the subtrees of the claim, minus duplicates and truisms (e.g. literals).
|
233
234
|
* The word "is" is a very nice separator since it doesn't look like code, but is short enough to be easily visually parsed.
|
234
|
-
* VALUE is `eval(SUBEXP).inspect
|
235
|
+
* VALUE is `eval(SUBEXP).inspect`, wrapped and indented if necessary to fit your console
|
235
236
|
|
236
237
|
We hope this structure lets your eyes focus on the meaningful values and differences in the message, rather than glossing over with stack-trace burnout. If you have any suggestions on how to improve it, please share them.
|
237
238
|
|
238
239
|
(Why does VALUE use `inspect` and not `to_s`? Because `inspect` on standard objects like String and Array are sure to show all relevant details, such as white space, in a console-safe way, and we hope other libraries follow suit. Also, `to_s` often inserts line breaks and that messes up formatting and legibility.)
|
239
240
|
|
240
|
-
Wrong tries to maintain indentation to improve readability. If the inspected VALUE contains newlines, the succeeding lines will be indented to
|
241
|
+
Wrong tries to maintain indentation to improve readability. If the inspected VALUE contains newlines, or is longer than will fit on your console, the succeeding lines will be indented to a pleasant level.
|
241
242
|
|
242
243
|
## Formatters ##
|
243
244
|
|
@@ -288,7 +289,7 @@ or any of these at runtime:
|
|
288
289
|
|
289
290
|
### Color ###
|
290
291
|
|
291
|
-
Apparently, no test framework is successful unless and until it supports console colors.
|
292
|
+
Apparently, no test framework is successful unless and until it supports console colors. Call
|
292
293
|
|
293
294
|
Wrong.config.color
|
294
295
|
|
data/lib/wrong.rb
CHANGED
data/lib/wrong/adapters/rspec.rb
CHANGED
@@ -15,11 +15,20 @@ if Object.const_defined? :RSpec
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
# This would work if we didn't need to define failure_class
|
19
|
+
# todo: figure out how to get RSpec's config object to class_eval or whatever
|
20
|
+
# Rspec.configure do |config|
|
21
|
+
# config.include Wrong
|
22
|
+
# def failure_class
|
23
|
+
# RSpec::Expectations::ExpectationNotMetError
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
|
18
27
|
module RSpec
|
19
28
|
module Core
|
20
29
|
class ExampleGroup
|
21
30
|
include Wrong
|
22
|
-
|
31
|
+
|
23
32
|
def failure_class
|
24
33
|
RSpec::Expectations::ExpectationNotMetError
|
25
34
|
end
|
data/lib/wrong/chunk.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ruby_parser'
|
2
2
|
require 'ruby2ruby'
|
3
|
+
require 'pp'
|
3
4
|
|
4
5
|
def require_optionally(library)
|
5
6
|
begin
|
@@ -63,8 +64,8 @@ module Wrong
|
|
63
64
|
# first try sourcify
|
64
65
|
@block.to_sexp[3] # the [3] is to strip out the "proc {" sourcify adds to everything
|
65
66
|
end
|
66
|
-
rescue
|
67
|
-
# fall through
|
67
|
+
rescue Exception => e
|
68
|
+
# sourcify failed, so fall through
|
68
69
|
end
|
69
70
|
|
70
71
|
# next try glomming
|
@@ -136,8 +137,8 @@ module Wrong
|
|
136
137
|
self.claim.to_ruby
|
137
138
|
rescue => e
|
138
139
|
# note: this is untested; it's to recover from when we can't locate the code
|
139
|
-
message = "Failed
|
140
|
-
raise
|
140
|
+
message = "Failed at #{file}:#{line_number} [couldn't retrieve source code due to #{e.inspect}]"
|
141
|
+
raise message
|
141
142
|
end
|
142
143
|
|
143
144
|
def parts(sexp = nil)
|
@@ -173,9 +174,25 @@ module Wrong
|
|
173
174
|
def details
|
174
175
|
@details ||= build_details
|
175
176
|
end
|
177
|
+
|
178
|
+
def pretty_value(value, starting_col = 0, indent_wrapped_lines = 6, width = Chunk.terminal_width)
|
179
|
+
# inspected = value.inspect
|
180
|
+
|
181
|
+
# note that if the first line overflows due to the starting column then pp won't wrap it right
|
182
|
+
inspected = PP.pp(value, "", width - starting_col).chomp
|
183
|
+
|
184
|
+
# this bit might be redundant with the pp call now
|
185
|
+
indented = indent_all(6, inspected)
|
186
|
+
if width
|
187
|
+
wrap_and_indent(indented, starting_col, indent_wrapped_lines, width)
|
188
|
+
else
|
189
|
+
indented
|
190
|
+
end
|
191
|
+
end
|
176
192
|
|
177
193
|
private
|
178
194
|
|
195
|
+
# todo: move to FailureMessage?
|
179
196
|
def build_details
|
180
197
|
require "wrong/rainbow" if Wrong.config[:color]
|
181
198
|
s = ""
|
@@ -193,12 +210,12 @@ module Wrong
|
|
193
210
|
part.gsub!(/\n/, newline(2))
|
194
211
|
part += newline(3)
|
195
212
|
end
|
196
|
-
value =
|
213
|
+
value = pretty_value(value, (4 + part.length + 4))
|
197
214
|
if Wrong.config[:color]
|
198
215
|
part = part.color(:blue)
|
199
216
|
value = value.color(:magenta)
|
200
217
|
end
|
201
|
-
details << indent(
|
218
|
+
details << indent(4, part, " is ", value)
|
202
219
|
end
|
203
220
|
rescue Exception => e
|
204
221
|
raises = "raises #{e.class}"
|
@@ -207,9 +224,9 @@ module Wrong
|
|
207
224
|
raises = raises.bold.color(:red)
|
208
225
|
end
|
209
226
|
formatted_exeption = if e.message and e.message != e.class.to_s
|
210
|
-
indent(
|
227
|
+
indent(4, part, " ", raises, ": ", indent_all(6, e.message))
|
211
228
|
else
|
212
|
-
indent(
|
229
|
+
indent(4, part, " ", raises)
|
213
230
|
end
|
214
231
|
details << formatted_exeption
|
215
232
|
end
|
@@ -227,7 +244,7 @@ module Wrong
|
|
227
244
|
|
228
245
|
public # don't know exactly why this needs to be public but eval'ed code can't find it otherwise
|
229
246
|
def indent(indent, *s)
|
230
|
-
"#{"
|
247
|
+
"#{" " * indent}#{s.join('')}"
|
231
248
|
end
|
232
249
|
|
233
250
|
def newline(indent)
|
@@ -237,6 +254,54 @@ public # don't know exactly why this needs to be public but eval'ed code can't f
|
|
237
254
|
def indent_all(amount, s)
|
238
255
|
s.gsub("\n", "\n#{indent(amount)}")
|
239
256
|
end
|
257
|
+
|
258
|
+
def wrap_and_indent(indented, starting_col, indent_wrapped_lines, full_width)
|
259
|
+
first_line = true
|
260
|
+
width = full_width - starting_col # the first line is essentially shorter
|
261
|
+
indented.split("\n").map do |line|
|
262
|
+
s = ""
|
263
|
+
while line.length > width
|
264
|
+
s << line[0...width]
|
265
|
+
s << newline(indent_wrapped_lines)
|
266
|
+
line = line[width..-1]
|
267
|
+
if first_line
|
268
|
+
width += starting_col - indent_wrapped_lines
|
269
|
+
first_line = false
|
270
|
+
end
|
271
|
+
end
|
272
|
+
s << line
|
273
|
+
s
|
274
|
+
end.join("\n")
|
275
|
+
end
|
276
|
+
|
277
|
+
# Returns [width, height] of terminal when detected, nil if not detected.
|
278
|
+
# Think of this as a simpler version of Highline's Highline::SystemExtensions.terminal_size()
|
279
|
+
# Lifted from https://github.com/cldwalker/hirb/blob/master/lib/hirb/util.rb#L59
|
280
|
+
def self.terminal_size
|
281
|
+
@@terminal_size ||= begin
|
282
|
+
if (ENV['COLUMNS'] =~ /^\d+$/) && (ENV['LINES'] =~ /^\d+$/)
|
283
|
+
[ENV['COLUMNS'].to_i, ENV['LINES'].to_i]
|
284
|
+
elsif (RUBY_PLATFORM =~ /java/ || (!STDIN.tty? && ENV['TERM'])) && command_exists?('tput')
|
285
|
+
[`tput cols`.to_i, `tput lines`.to_i]
|
286
|
+
elsif STDIN.tty? && command_exists?('stty')
|
287
|
+
`stty size`.scan(/\d+/).map { |s| s.to_i }.reverse
|
288
|
+
else
|
289
|
+
nil
|
290
|
+
end
|
291
|
+
rescue
|
292
|
+
nil
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
def self.terminal_width
|
297
|
+
terminal_size && terminal_size.first
|
298
|
+
end
|
299
|
+
|
300
|
+
# Determines if a shell command exists by searching for it in ENV['PATH'].
|
301
|
+
def self.command_exists?(command)
|
302
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }
|
303
|
+
end
|
304
|
+
|
240
305
|
|
241
306
|
end
|
242
307
|
|
data/lib/wrong/version.rb
CHANGED
@@ -13,6 +13,15 @@ require "wrong/adapters/rspec"
|
|
13
13
|
# since we're not running 'spec' we have to do some stuff ourselves
|
14
14
|
include Spec::DSL::Main
|
15
15
|
|
16
|
+
describe "wrong's failure" do
|
17
|
+
it "is an RSpec exception" do
|
18
|
+
e = rescuing {
|
19
|
+
assert { false }
|
20
|
+
}
|
21
|
+
e.should be_a(Spec::Expectations::ExpectationNotMetError)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
16
25
|
describe "arithmetic" do
|
17
26
|
it "should not work like this" do
|
18
27
|
assert { 2 + 2 == 5 }
|
@@ -17,6 +17,15 @@ puts RSpec::Core::Version::STRING
|
|
17
17
|
require 'rspec/autorun'
|
18
18
|
require "wrong/adapters/rspec"
|
19
19
|
|
20
|
+
describe "wrong's failure" do
|
21
|
+
it "is an RSpec exception" do
|
22
|
+
e = rescuing {
|
23
|
+
assert { false }
|
24
|
+
}
|
25
|
+
e.should be_a(RSpec::Expectations::ExpectationNotMetError)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
20
29
|
describe "arithmetic" do
|
21
30
|
it "should not work like this" do
|
22
31
|
assert { 2 + 2 == 5 }
|
data/test/adapters/rspec_test.rb
CHANGED
@@ -36,7 +36,7 @@ describe "testing rspec" do
|
|
36
36
|
(rspec_version == 1 || RUBY_VERSION =~ /^1\.8\./ || RUBY_VERSION == '1.9.1' ? nil : 1) # RSpec v1 exits with 0 on failure :-(
|
37
37
|
end
|
38
38
|
|
39
|
-
assert { spec_output.include? "
|
39
|
+
assert { spec_output.include? "2 examples, 1 failure" }
|
40
40
|
assert { spec_output.include? "Expected ((2 + 2) == 5), but" }
|
41
41
|
end
|
42
42
|
end
|
data/test/chunk_test.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
1
|
+
here = File.expand_path(File.dirname(__FILE__))
|
2
|
+
require "#{here}/test_helper"
|
2
3
|
require "wrong/chunk"
|
4
|
+
require 'yaml'
|
3
5
|
|
4
6
|
unless Object.const_defined?(:Chunk)
|
5
7
|
Chunk = Wrong::Chunk
|
@@ -74,7 +76,7 @@ describe Chunk do
|
|
74
76
|
end
|
75
77
|
|
76
78
|
it "finds the file to parse even when inside a chdir to a child directory" do
|
77
|
-
Dir.chdir("
|
79
|
+
Dir.chdir("#{here}") do
|
78
80
|
chunk = Chunk.new __FILE__, __LINE__ + 1; <<-CODE
|
79
81
|
"hi"
|
80
82
|
CODE
|
@@ -255,6 +257,15 @@ z
|
|
255
257
|
assert d == "\n" + ' x is "flavor:\tvanilla"' + "\n"
|
256
258
|
end
|
257
259
|
|
260
|
+
it "splits lower-down details correctly (bug)" do
|
261
|
+
hash = {:flavor => "vanilla"}
|
262
|
+
exception_with_newlines = Exception.new(hash.to_yaml.chomp)
|
263
|
+
d = details {
|
264
|
+
rescuing { raise exception_with_newlines }.message.include?(":flavor: chocolate")
|
265
|
+
}
|
266
|
+
assert d.include? "exception_with_newlines is #<Exception: --- \n :flavor: vanilla>"
|
267
|
+
end
|
268
|
+
|
258
269
|
it "skips assignments" do
|
259
270
|
y = 14
|
260
271
|
d = details { x = 7; y }
|
@@ -262,17 +273,88 @@ z
|
|
262
273
|
assert d =~ /y is 14/
|
263
274
|
end
|
264
275
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
276
|
+
class Weirdo
|
277
|
+
def initialize(inspected_value)
|
278
|
+
@inspected_value = inspected_value
|
279
|
+
end
|
280
|
+
|
281
|
+
def inspect
|
282
|
+
@inspected_value
|
270
283
|
end
|
284
|
+
end
|
285
|
+
|
271
286
|
|
272
|
-
|
287
|
+
it "indents unescaped newlines inside the inspected value" do
|
288
|
+
x = Weirdo.new("first\nsecond\nthird")
|
273
289
|
d = details { assert { x == "foo" } }
|
274
290
|
assert d == "\n x is first\n second\n third\n"
|
275
291
|
end
|
292
|
+
|
293
|
+
describe '#pretty_value' do
|
294
|
+
before do
|
295
|
+
@chunk = chunk = Chunk.new(__FILE__, __LINE__ + 1); <<-CODE
|
296
|
+
true
|
297
|
+
CODE
|
298
|
+
end
|
299
|
+
|
300
|
+
it 'inspects its value' do
|
301
|
+
assert @chunk.pretty_value(12) == "12"
|
302
|
+
assert @chunk.pretty_value("foo") == "\"foo\""
|
303
|
+
end
|
304
|
+
|
305
|
+
it 'escapes newlines in strings' do
|
306
|
+
assert @chunk.pretty_value("foo\nbar\nbaz") == "\"foo\\nbar\\nbaz\""
|
307
|
+
end
|
308
|
+
|
309
|
+
it 'indents newlines in raw inspect values (e.g. exceptions or YAML or whatever)' do
|
310
|
+
w = Weirdo.new("foo\nbar\nbaz")
|
311
|
+
assert @chunk.pretty_value(w) == "foo\n bar\n baz"
|
312
|
+
end
|
313
|
+
|
314
|
+
# def pretty_value(value, starting_col = 0, indent_wrapped_lines = 3, size = Chunk.terminal_size)
|
315
|
+
|
316
|
+
it 'inserts newlines in really long values, wrapped at the terminal width' do
|
317
|
+
abc = Weirdo.new("abcdefghijklmnopqrstuvwxyz")
|
318
|
+
pretty = @chunk.pretty_value(abc, 0, 0, 10)
|
319
|
+
assert pretty == <<-DONE.chomp
|
320
|
+
abcdefghij
|
321
|
+
klmnopqrst
|
322
|
+
uvwxyz
|
323
|
+
DONE
|
324
|
+
end
|
325
|
+
|
326
|
+
it 'subtracts the starting column from the wrapped width of the first line' do
|
327
|
+
abc = Weirdo.new("abcdefghijklmnopqrstuvwxyz")
|
328
|
+
pretty = @chunk.pretty_value(abc, 2, 0, 10)
|
329
|
+
assert pretty == <<-DONE.chomp
|
330
|
+
abcdefgh
|
331
|
+
ijklmnopqr
|
332
|
+
stuvwxyz
|
333
|
+
DONE
|
334
|
+
end
|
335
|
+
|
336
|
+
it "indents wrapped lines" do
|
337
|
+
abc = Weirdo.new("abcdefghijklmnopqrstuvwxyz")
|
338
|
+
pretty = @chunk.pretty_value(abc, 2, 3, 10)
|
339
|
+
assert pretty == <<-DONE.chomp
|
340
|
+
abcdefgh
|
341
|
+
ijklmno
|
342
|
+
pqrstuv
|
343
|
+
wxyz
|
344
|
+
DONE
|
345
|
+
end
|
346
|
+
|
347
|
+
it "wraps correctly" do
|
348
|
+
hash = {:flavor => "vanilla"}
|
349
|
+
object = Weirdo.new(hash.to_yaml.chomp)
|
350
|
+
pretty = @chunk.pretty_value(object, 2, 3, 80)
|
351
|
+
assert pretty == <<-DONE.chomp
|
352
|
+
---
|
353
|
+
:flavor: vanilla
|
354
|
+
DONE
|
355
|
+
end
|
356
|
+
|
357
|
+
end
|
276
358
|
|
277
359
|
end
|
278
360
|
end
|
data/test/d_test.rb
CHANGED
metadata
CHANGED
@@ -3,129 +3,137 @@ name: wrong
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
version: 0.
|
6
|
+
- 0
|
7
|
+
- 5
|
8
|
+
- 0
|
9
|
+
version: 0.5.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
|
-
|
13
|
-
|
12
|
+
- Steve Conover
|
13
|
+
- Alex Chaffee
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-08 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: predicated
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 2
|
31
|
+
- 2
|
32
|
+
version: 0.2.2
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ruby_parser
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 2
|
45
|
+
- 0
|
46
|
+
- 4
|
47
|
+
version: 2.0.4
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: ruby2ruby
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ~>
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 1
|
60
|
+
- 2
|
61
|
+
version: "1.2"
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: sexp_processor
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ~>
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 3
|
74
|
+
- 0
|
75
|
+
version: "3.0"
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: *id004
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: diff-lcs
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ~>
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 1
|
88
|
+
- 1
|
89
|
+
- 2
|
90
|
+
version: 1.1.2
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: *id005
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: ParseTree
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
segments:
|
102
|
+
- 3
|
103
|
+
- 0
|
104
|
+
version: "3.0"
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: *id006
|
108
|
+
- !ruby/object:Gem::Dependency
|
109
|
+
name: sourcify
|
110
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
segments:
|
116
|
+
- 0
|
117
|
+
- 3
|
118
|
+
- 0
|
119
|
+
version: 0.3.0
|
120
|
+
type: :runtime
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: *id007
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: file-tail
|
125
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ~>
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
segments:
|
131
|
+
- 1
|
132
|
+
- 0
|
133
|
+
version: "1.0"
|
134
|
+
type: :runtime
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: *id008
|
129
137
|
description: |-
|
130
138
|
Wrong provides a general assert method that takes a predicate block. Assertion failure
|
131
139
|
messages are rich in detail. The Wrong idea is to replace all those countless assert_this,
|
@@ -139,28 +147,70 @@ executables: []
|
|
139
147
|
extensions: []
|
140
148
|
|
141
149
|
extra_rdoc_files:
|
142
|
-
|
150
|
+
- README.markdown
|
143
151
|
files:
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
152
|
+
- lib/wrong/adapters/minitest.rb
|
153
|
+
- lib/wrong/adapters/rspec.rb
|
154
|
+
- lib/wrong/adapters/test_unit.rb
|
155
|
+
- lib/wrong/assert.rb
|
156
|
+
- lib/wrong/chunk.rb
|
157
|
+
- lib/wrong/close_to.rb
|
158
|
+
- lib/wrong/config.rb
|
159
|
+
- lib/wrong/d.rb
|
160
|
+
- lib/wrong/failure_message.rb
|
161
|
+
- lib/wrong/helpers.rb
|
162
|
+
- lib/wrong/irb.rb
|
163
|
+
- lib/wrong/message/array_diff.rb
|
164
|
+
- lib/wrong/message/string_comparison.rb
|
165
|
+
- lib/wrong/message/test_context.rb
|
166
|
+
- lib/wrong/rainbow.rb
|
167
|
+
- lib/wrong/ruby2ruby_patch.rb
|
168
|
+
- lib/wrong/sexp_ext.rb
|
169
|
+
- lib/wrong/version.rb
|
170
|
+
- lib/wrong.rb
|
171
|
+
- README.markdown
|
172
|
+
- test/adapters/minitest_test.rb
|
173
|
+
- test/adapters/railsapp/app/controllers/application_controller.rb
|
174
|
+
- test/adapters/railsapp/app/helpers/application_helper.rb
|
175
|
+
- test/adapters/railsapp/autotest/discover.rb
|
176
|
+
- test/adapters/railsapp/config/application.rb
|
177
|
+
- test/adapters/railsapp/config/boot.rb
|
178
|
+
- test/adapters/railsapp/config/environment.rb
|
179
|
+
- test/adapters/railsapp/config/environments/development.rb
|
180
|
+
- test/adapters/railsapp/config/environments/production.rb
|
181
|
+
- test/adapters/railsapp/config/environments/test.rb
|
182
|
+
- test/adapters/railsapp/config/initializers/backtrace_silencers.rb
|
183
|
+
- test/adapters/railsapp/config/initializers/inflections.rb
|
184
|
+
- test/adapters/railsapp/config/initializers/mime_types.rb
|
185
|
+
- test/adapters/railsapp/config/initializers/secret_token.rb
|
186
|
+
- test/adapters/railsapp/config/initializers/session_store.rb
|
187
|
+
- test/adapters/railsapp/config/routes.rb
|
188
|
+
- test/adapters/railsapp/db/seeds.rb
|
189
|
+
- test/adapters/railsapp/spec/spec_helper.rb
|
190
|
+
- test/adapters/railsapp/spec/wrong_spec.rb
|
191
|
+
- test/adapters/rspec1/failing_spec.rb
|
192
|
+
- test/adapters/rspec2/failing_spec.rb
|
193
|
+
- test/adapters/rspec_rails_test.rb
|
194
|
+
- test/adapters/rspec_test.rb
|
195
|
+
- test/adapters/test_unit_test.rb
|
196
|
+
- test/assert_advanced_test.rb
|
197
|
+
- test/assert_test.rb
|
198
|
+
- test/capturing_test.rb
|
199
|
+
- test/chunk_test.rb
|
200
|
+
- test/close_to_test.rb
|
201
|
+
- test/config_test.rb
|
202
|
+
- test/d_test.rb
|
203
|
+
- test/failure_message_test.rb
|
204
|
+
- test/failures_test.rb
|
205
|
+
- test/message/array_diff_test.rb
|
206
|
+
- test/message/test_context_test.rb
|
207
|
+
- test/rescuing_test.rb
|
208
|
+
- test/separate.rb
|
209
|
+
- test/sexp_ext_test.rb
|
210
|
+
- test/string_comparison_test.rb
|
211
|
+
- test/suite.rb
|
212
|
+
- test/test_helper.rb
|
213
|
+
- test/wrong_test.rb
|
164
214
|
has_rdoc: true
|
165
215
|
homepage: http://github.com/sconover/wrong
|
166
216
|
licenses: []
|
@@ -169,68 +219,71 @@ post_install_message:
|
|
169
219
|
rdoc_options: []
|
170
220
|
|
171
221
|
require_paths:
|
172
|
-
|
222
|
+
- lib
|
173
223
|
required_ruby_version: !ruby/object:Gem::Requirement
|
224
|
+
none: false
|
174
225
|
requirements:
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
226
|
+
- - ">="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
hash: -2030661794570010532
|
229
|
+
segments:
|
230
|
+
- 0
|
231
|
+
version: "0"
|
180
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
181
234
|
requirements:
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
235
|
+
- - ">="
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
segments:
|
238
|
+
- 0
|
239
|
+
version: "0"
|
187
240
|
requirements: []
|
188
241
|
|
189
242
|
rubyforge_project: wrong
|
190
|
-
rubygems_version: 1.3.
|
243
|
+
rubygems_version: 1.3.7
|
191
244
|
signing_key:
|
192
245
|
specification_version: 3
|
193
246
|
summary: Wrong provides a general assert method that takes a predicate block. Assertion failure messages are rich in detail.
|
194
247
|
test_files:
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
248
|
+
- test/adapters/minitest_test.rb
|
249
|
+
- test/adapters/railsapp/app/controllers/application_controller.rb
|
250
|
+
- test/adapters/railsapp/app/helpers/application_helper.rb
|
251
|
+
- test/adapters/railsapp/autotest/discover.rb
|
252
|
+
- test/adapters/railsapp/config/application.rb
|
253
|
+
- test/adapters/railsapp/config/boot.rb
|
254
|
+
- test/adapters/railsapp/config/environment.rb
|
255
|
+
- test/adapters/railsapp/config/environments/development.rb
|
256
|
+
- test/adapters/railsapp/config/environments/production.rb
|
257
|
+
- test/adapters/railsapp/config/environments/test.rb
|
258
|
+
- test/adapters/railsapp/config/initializers/backtrace_silencers.rb
|
259
|
+
- test/adapters/railsapp/config/initializers/inflections.rb
|
260
|
+
- test/adapters/railsapp/config/initializers/mime_types.rb
|
261
|
+
- test/adapters/railsapp/config/initializers/secret_token.rb
|
262
|
+
- test/adapters/railsapp/config/initializers/session_store.rb
|
263
|
+
- test/adapters/railsapp/config/routes.rb
|
264
|
+
- test/adapters/railsapp/db/seeds.rb
|
265
|
+
- test/adapters/railsapp/spec/spec_helper.rb
|
266
|
+
- test/adapters/railsapp/spec/wrong_spec.rb
|
267
|
+
- test/adapters/rspec1/failing_spec.rb
|
268
|
+
- test/adapters/rspec2/failing_spec.rb
|
269
|
+
- test/adapters/rspec_rails_test.rb
|
270
|
+
- test/adapters/rspec_test.rb
|
271
|
+
- test/adapters/test_unit_test.rb
|
272
|
+
- test/assert_advanced_test.rb
|
273
|
+
- test/assert_test.rb
|
274
|
+
- test/capturing_test.rb
|
275
|
+
- test/chunk_test.rb
|
276
|
+
- test/close_to_test.rb
|
277
|
+
- test/config_test.rb
|
278
|
+
- test/d_test.rb
|
279
|
+
- test/failure_message_test.rb
|
280
|
+
- test/failures_test.rb
|
281
|
+
- test/message/array_diff_test.rb
|
282
|
+
- test/message/test_context_test.rb
|
283
|
+
- test/rescuing_test.rb
|
284
|
+
- test/separate.rb
|
285
|
+
- test/sexp_ext_test.rb
|
286
|
+
- test/string_comparison_test.rb
|
287
|
+
- test/suite.rb
|
288
|
+
- test/test_helper.rb
|
289
|
+
- test/wrong_test.rb
|