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
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.0/test/test_base.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/test/test_base.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/test/test_base.rb
parser-2.4.0.0 test/test_base.rb
parser-2.3.3.1 test/test_base.rb
parser-2.3.3.0 test/test_base.rb
parser-2.3.2.0 test/test_base.rb
parser-2.3.1.4 test/test_base.rb
parser-2.3.1.3 test/test_base.rb
erruby_parser-2.3.1.2 test/test_base.rb
parser-2.3.1.2 test/test_base.rb
parser-2.3.1.1 test/test_base.rb
parser-2.3.1.0 test/test_base.rb
parser-2.3.0.7 test/test_base.rb
parser-2.3.0.6 test/test_base.rb
parser-2.3.0.5 test/test_base.rb
parser-2.3.0.4 test/test_base.rb
parser-2.3.0.3 test/test_base.rb
parser-2.3.0.2 test/test_base.rb
parser-2.3.0.1 test/test_base.rb