Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Fixed Sexp#mass lying when using auto_shifted sexps.

[git-p4: depot-paths = "//src/sexp_processor/dev/": change = 8061]
  • Loading branch information...
commit cd3f26e8a401d1e8479a2c39dac9e89c70c32443 1 parent bf34d19
@zenspider zenspider authored
Showing with 12 additions and 2 deletions.
  1. +1 −2  lib/sexp.rb
  2. +11 −0 test/test_sexp.rb
View
3  lib/sexp.rb
@@ -249,8 +249,7 @@ def shift
def structure
result = self.class.new
if Array === self.first then
- raise "When does this happen? #{self.inspect}" # TODO: remove >= 4.2.0
- result = self.first.structure
+ result = s(:bogus, *self).structure # TODO: remove >= 4.2.0
else
result << self.first
self.grep(Sexp).each do |subexp|
View
11 test/test_sexp.rb
@@ -203,6 +203,17 @@ def test_mass
assert_equal 7, s.mass
end
+ def test_mass_auto_shift
+ assert_equal 1, s(:a).mass
+ assert_equal 3, s(s(:b), s(:c)).mass
+
+ s = s(s(:call, nil, :a, s(:arglist, s(:lit, 1))),
+ s(:lasgn, :c),
+ s(:call, nil, :d, s(:arglist)))
+
+ assert_equal 7, s.mass
+ end
+
def test_method_missing
assert_nil @sexp.not_there
assert_equal s(:lit, 42), @basic_sexp.lit
Please sign in to comment.
Something went wrong with that request. Please try again.