Permalink
Browse files

support line for Sexp :opassign

  • Loading branch information...
1 parent d8acfeb commit b8d36d3240379d74215cba6bf6bcdd0ad2059ce1 @flyerhzm committed Sep 17, 2012
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/code_analyzer/sexp.rb
  2. +7 −0 spec/code_analyzer/sexp_spec.rb
@@ -22,7 +22,7 @@ def line
self[1].line
when :assoclist_from_args, :bare_assoc_hash
self[1][0].line
- when :string_add
+ when :string_add, :opassign
self[2].line
when :array
array_values.first.line
@@ -13,6 +13,9 @@ def test
def massign
a, b = 10, 20
end
+ def opassign(a, b)
+ a+= b
+ end
end
EOF
@node = parse_content(content)
@@ -45,6 +48,10 @@ def massign
it "should return massign line" do
@node.grep_node(sexp_type: :massign).line.should == 8
end
+
+ it "should return opassign line" do
+ @node.grep_node(sexp_type: :opassign).line.should == 11
+ end
end
describe "grep_nodes" do

0 comments on commit b8d36d3

Please sign in to comment.