Sha256: 4ef69520534f9506cd4000502fd9a50e8b96e857746252eed5f267141ac6ecd3

Contents?: true

Size: 623 Bytes

Versions: 9

Compression:

Stored size: 623 Bytes

Contents

require 'spec_helper'

describe Unparser::Comments, '#consume' do

  let(:ast_and_comments) do
    Unparser.parse_with_comments(<<~'RUBY')
      def hi # EOL 1
      end # EOL 2
    RUBY
  end
  let(:ast)      { ast_and_comments[0] }
  let(:comments) { ast_and_comments[1] }
  let(:object)   { described_class.new(comments) }

  it 'should cause further EOL comments to be returned' do
    expect(object.take_eol_comments).to eql([])
    object.consume(ast, :name)
    expect(object.take_eol_comments).to eql([comments[0]])
    object.consume(ast, :end)
    expect(object.take_eol_comments).to eql([comments[1]])
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
unparser-0.4.8 spec/unit/unparser/comments/consume_spec.rb
unparser-0.4.7 spec/unit/unparser/comments/consume_spec.rb
unparser-0.4.6 spec/unit/unparser/comments/consume_spec.rb
unparser-0.4.5 spec/unit/unparser/comments/consume_spec.rb
unparser-0.4.4 spec/unit/unparser/comments/consume_spec.rb
unparser-0.4.3 spec/unit/unparser/comments/consume_spec.rb
unparser-0.4.2 spec/unit/unparser/comments/consume_spec.rb
unparser-0.4.1 spec/unit/unparser/comments/consume_spec.rb
unparser-0.4.0 spec/unit/unparser/comments/consume_spec.rb