Sha256: 0491cd716353f81b8fb419a84a550b9987df5b4e3317a1752673721ceefef355

Contents?: true

Size: 716 Bytes

Versions: 12

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

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(:zsuper, [], :location => ast.loc)
  end
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
passbase-1.3.0 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/test/test_base.rb
passbase-1.2.0 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/test/test_base.rb
passbase-1.1.0 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/test/test_base.rb
passbase-1.0.3 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/test/test_base.rb
passbase-1.0.2 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/test/test_base.rb
passbase-1.0.1 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/test/test_base.rb
passbase-1.0.0 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/test/test_base.rb
parser-2.7.1.5 test/test_base.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/parser-2.7.1.4/test/test_base.rb
files.com-1.0.1 vendor/bundle/ruby/2.5.0/gems/parser-2.7.1.4/test/test_base.rb
parser-2.7.1.4 test/test_base.rb
parser-2.7.1.3 test/test_base.rb