power_assert 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c655c4859384e9b6f80ca57638052de99d3d8a9d
4
- data.tar.gz: d6ece1d15b1e83133b2e77eef2c03b2ed1b441fe
3
+ metadata.gz: ac2d67b15f362a642ebe57434047e526ddc386dc
4
+ data.tar.gz: dc515760f9b1fa257188a4745a2a713d6522be6d
5
5
  SHA512:
6
- metadata.gz: 0f7e60fc27d31672583e8e9916192165bbb05e495ffb3a283a8d37012b136efab29a6acd36412450057bcaa1b19cf7bff5fa323092bf4e6a96dd1c94e044a940
7
- data.tar.gz: 8df7fa120664045dcbae9fad42b8babd4c744daa76d50990cd35642b1e9c3c51b605f72940a3ce0400cd2ee7c0da0a051fec29d56bba2a6729356e3e44a28ed5
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
@@ -1,3 +1,3 @@
1
1
  module PowerAssert
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: power_assert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuki Tsujimoto