Sha256: 6df550c63c559b2f194988f46e7bead34e4f977424d0903f6e77a1bfe284a5b8

Contents?: true

Size: 690 Bytes

Versions: 35

Compression:

Stored size: 690 Bytes

Contents

require 'helper'
require 'parser/current'

class TestBase < Minitest::Test
  include AST::Sexp

  def test_parse
    ast = Parser::CurrentRuby.parse('1')
    assert_equal s(:int, 1), ast
  end

  def test_parse_with_comments
    ast, comments = Parser::CurrentRuby.parse_with_comments('1 # foo')
    assert_equal s(:int, 1), ast
    assert_equal 1, comments.size
    assert_equal '# foo', comments.first.text
  end

  def test_loc_to_node
    ast = Parser::CurrentRuby.parse('1')
    assert_equal ast.loc.node, ast
  end

  def test_loc_dup
    ast = Parser::CurrentRuby.parse('1')
    assert_equal nil, ast.loc.dup.node
    Parser::AST::Node.new(:root, [], :location => ast.loc)
  end
end

Version data entries

35 entries across 35 versions & 4 rubygems

Version Path
parser-2.3.0.0 test/test_base.rb
parser-2.3.0.pre.6 test/test_base.rb
parser-2.3.0.pre.5 test/test_base.rb
parser-2.3.0.pre.4 test/test_base.rb
parser-2.3.0.pre.3 test/test_base.rb
parser-2.2.3.0 test/test_base.rb
parser-2.2.2.6 test/test_base.rb
parser-2.3.0.pre.2 test/test_base.rb
parser-2.3.0.pre.1 test/test_base.rb
parser-2.2.2.5 test/test_base.rb
parser-2.2.2.3 test/test_base.rb
parser-2.2.2.2 test/test_base.rb
parser-2.2.2.1 test/test_base.rb
parser-2.2.2.0 test/test_base.rb
parser-2.2.0.4 test/test_base.rb