Skip to content

Commit

Permalink
moved and renamed some tests
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//src/ruby_parser/dev/": change = 6435]
  • Loading branch information
zenspider committed Jul 5, 2011
1 parent 9fa1dee commit d5f6dd0
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions test/test_ruby_parser.rb
Expand Up @@ -439,7 +439,7 @@ def after_process_hook klass, node, data, input_name, output_name
assert_equal expected, @result.line, "should have proper line number"
end

def test_position_info
def test_position_info_block
rb = "a = 42\np a"
pt = s(:block,
s(:lasgn, :a, s(:lit, 42)),
Expand All @@ -463,7 +463,7 @@ def test_position_info
assert_same result.file, result.call.file
end

def test_position_info2
def test_position_info_defn
rb = "def x(y)\n p(y)\n y *= 2\n return y;\nend" # TODO: remove () & ;
pt = s(:defn, :x, s(:args, :y),
s(:scope,
Expand All @@ -485,6 +485,18 @@ def test_position_info2
assert_equal 4, body.return.line, "return should have line number"
end

def test_position_info_heredoc
rb = <<-CODE
string = <<-HEREDOC
very long string
HEREDOC
puts string
CODE

result = @processor.parse rb
assert_equal 1, result.lasgn.line
assert_equal 4, result.call.line
end

def test_parse_if_not_canonical
rb = "if not var.nil? then 'foo' else 'bar'\nend"
Expand Down Expand Up @@ -551,17 +563,4 @@ def test_parse_until_not_noncanonical

assert_equal pt, @processor.parse(rb)
end

def test_line_number_after_heredoc
rb = <<-CODE
string = <<-HEREDOC
very long string
HEREDOC
puts string
CODE

result = @processor.parse rb
assert_equal 1, result.lasgn.line
assert_equal 4, result.call.line
end
end

0 comments on commit d5f6dd0

Please sign in to comment.