Sha256: a5b9c1b76eebe6c66f6e15e652bc25a53e4bbb35598f96903ba2a4ca717084de

Contents?: true

Size: 651 Bytes

Versions: 16

Compression:

Stored size: 651 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Unparser::Comments, '#consume' do

  let(:ast_and_comments) do
    Parser::CurrentRuby.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

16 entries across 16 versions & 1 rubygems

Version Path
unparser-0.2.4 spec/unit/unparser/comments/consume_spec.rb
unparser-0.2.3 spec/unit/unparser/comments/consume_spec.rb
unparser-0.2.2 spec/unit/unparser/comments/consume_spec.rb
unparser-0.2.1 spec/unit/unparser/comments/consume_spec.rb
unparser-0.2.0 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.16 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.15 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.14 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.13 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.12 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.11 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.10 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.9 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.8 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.7 spec/unit/unparser/comments/consume_spec.rb
unparser-0.1.6 spec/unit/unparser/comments/consume_spec.rb