Sha256: ca9855f10863bf82e7dc9ad93f9965bf3e3ae7ccc8ec20cf5ecc19ff3960bc97
Contents?: true
Size: 897 Bytes
Versions: 9
Compression:
Stored size: 897 Bytes
Contents
require 'spec_helper' describe Unparser::Comments, '#take_eol_comments' do let(:ast_and_comments) do Unparser.parse_with_comments(<<~'RUBY') def hi # EOL 1 =begin doc comment =end 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 return no comments if nothing has been consumed' do expect(object.take_eol_comments).to eql([]) end it 'should return comments once their line has been consumed' do object.consume(ast, :name) expect(object.take_eol_comments).to eql([comments[0]]) end it 'should leave doc comments to be taken later' do object.consume(ast) expect(object.take_eol_comments).to eql([comments[0], comments[2]]) expect(object.take_all).to eql([comments[1]]) end end
Version data entries
9 entries across 9 versions & 1 rubygems