Sha256: fd45dba8281fb70b67c07e0de4a31ebe798cda4f8f136f3b54c1ed4bbffb0ada

Contents?: true

Size: 683 Bytes

Versions: 8

Compression:

Stored size: 683 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_nil ast.loc.dup.node
    Parser::AST::Node.new(:root, [], :location => ast.loc)
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/test/test_base.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/test/test_base.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/test_base.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/test_base.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/test_base.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/test_base.rb
parser-2.4.0.2 test/test_base.rb
parser-2.4.0.1 test/test_base.rb