Sha256: 979082bf37830049bfd31a89a52179ca4999440550b30d411b06bdac808987b9

Contents?: true

Size: 780 Bytes

Versions: 87

Compression:

Stored size: 780 Bytes

Contents

require 'helper'

class TestSourceComment < Minitest::Test
  def setup
    @buf = Parser::Source::Buffer.new('(string)')
    @buf.source = "# foo\n=begin foo\nbar\n=end baz\n"
  end

  def range(s, e)
    Parser::Source::Range.new(@buf, s, e)
  end

  def test_initialize
    comment = Parser::Source::Comment.new(range(0, 5))
    assert comment.frozen?
  end

  def test_text
    comment = Parser::Source::Comment.new(range(0, 5))
    assert_equal '# foo', comment.text
  end

  def test_inline
    comment = Parser::Source::Comment.new(range(0, 5))
    assert_equal :inline, comment.type
    assert comment.inline?
  end

  def test_document
    comment = Parser::Source::Comment.new(range(6, 25))
    assert_equal :document, comment.type
    assert comment.document?
  end
end

Version data entries

87 entries across 87 versions & 5 rubygems

Version Path
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/test/test_source_comment.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/test/test_source_comment.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/test_source_comment.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/test_source_comment.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/test_source_comment.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/test_source_comment.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.0/test/test_source_comment.rb
parser-2.4.0.2 test/test_source_comment.rb
parser-2.4.0.1 test/test_source_comment.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/test/test_source_comment.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/test/test_source_comment.rb
parser-2.4.0.0 test/test_source_comment.rb
parser-2.3.3.1 test/test_source_comment.rb
parser-2.3.3.0 test/test_source_comment.rb
parser-2.3.2.0 test/test_source_comment.rb
parser-2.3.1.4 test/test_source_comment.rb
parser-2.3.1.3 test/test_source_comment.rb
erruby_parser-2.3.1.2 test/test_source_comment.rb
parser-2.3.1.2 test/test_source_comment.rb
parser-2.3.1.1 test/test_source_comment.rb