power_assert 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/power_assert.rb +9 -9
- data/lib/power_assert/version.rb +1 -1
- data/test/test_power_assert.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac2d67b15f362a642ebe57434047e526ddc386dc
|
4
|
+
data.tar.gz: dc515760f9b1fa257188a4745a2a713d6522be6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 956fc1290880bf653dc70c59b35216db33e8bbe09517a04639b47c1d3e81c642fe682d829e1d71ecb36fc2e3f7e3c4bb04727ffa6a1ea8814b7b4621a437dd28
|
7
|
+
data.tar.gz: b18c7f57d7cbe043fa4b621914a8426569f81654ccec756054d8806749f78d467d5b830776411088ea7ac839d4e09f65f9d3be31783bcd31c829f9dc647e3f18
|
data/Rakefile
CHANGED
@@ -4,6 +4,6 @@ require "rake/testtask"
|
|
4
4
|
task :default => :test
|
5
5
|
Rake::TestTask.new do |t|
|
6
6
|
# helper(simplecov) must be required before loading power_assert
|
7
|
-
t.ruby_opts = ["-r./test/helper", "-rpower_assert"]
|
7
|
+
t.ruby_opts = ["-w", "-r./test/helper", "-rpower_assert"]
|
8
8
|
t.test_files = FileList["test/test_*.rb"]
|
9
9
|
end
|
data/lib/power_assert.rb
CHANGED
@@ -132,15 +132,6 @@ module PowerAssert
|
|
132
132
|
[sexp[1], sexp[4], sexp[3]].flat_map {|s| extract_idents(s) }
|
133
133
|
when :aref
|
134
134
|
handle_columnless_ident(extract_idents(sexp[1]), :[], extract_idents(sexp[2]))
|
135
|
-
when :program
|
136
|
-
_, ((tag0, (tag1, (tag2, (tag3, mname, _)), _), (tag4, _, ss))) = sexp
|
137
|
-
if tag0 == :method_add_block and tag1 == :method_add_arg and tag2 == :fcall and
|
138
|
-
tag3 == :@ident and mname == @assertion_method_name and (tag4 == :brace_block or tag4 == :do_block)
|
139
|
-
ss.flat_map {|s| extract_idents(s) }
|
140
|
-
else
|
141
|
-
_, (s, *) = sexp
|
142
|
-
extract_idents(s)
|
143
|
-
end
|
144
135
|
when :method_add_arg
|
145
136
|
idents = extract_idents(sexp[1])
|
146
137
|
idents[0..-2] + extract_idents(sexp[2]) + [idents[-1]]
|
@@ -158,6 +149,15 @@ module PowerAssert
|
|
158
149
|
else
|
159
150
|
[]
|
160
151
|
end
|
152
|
+
when :program
|
153
|
+
_, ((tag0, (tag1, (tag2, (tag3, mname, _)), _), (tag4, _, ss))) = sexp
|
154
|
+
if tag0 == :method_add_block and tag1 == :method_add_arg and tag2 == :fcall and
|
155
|
+
tag3 == :@ident and mname == @assertion_method_name and (tag4 == :brace_block or tag4 == :do_block)
|
156
|
+
ss.flat_map {|s| extract_idents(s) }
|
157
|
+
else
|
158
|
+
_, (s, *) = sexp
|
159
|
+
extract_idents(s)
|
160
|
+
end
|
161
161
|
when :var_ref
|
162
162
|
_, (tag, ref_name, (_, column)) = sexp
|
163
163
|
case tag
|
data/lib/power_assert/version.rb
CHANGED
data/test/test_power_assert.rb
CHANGED
@@ -110,7 +110,7 @@ class TestPowerAssert < Test::Unit::TestCase
|
|
110
110
|
|
111
111
|
EXTRACT_METHODS_TEST.each_with_index do |(expect, source), idx|
|
112
112
|
define_method("test_extract_methods_#{'%03d' % idx}") do
|
113
|
-
pa = PowerAssert.const_get(:Context).new(-> { var = nil; -> {} }.(), nil)
|
113
|
+
pa = PowerAssert.const_get(:Context).new(-> { var = nil; -> { var } }.(), nil)
|
114
114
|
pa.instance_variable_set(:@line, source)
|
115
115
|
pa.instance_variable_set(:@assertion_method_name, 'assertion_message')
|
116
116
|
assert_equal expect, pa.send(:extract_idents, Ripper.sexp(source)).map(&:to_a), source
|