Sha256: b66a8a856658d0ea72ef9b51a64d7d2aa911db04bf1e67bc50cf81e6bc07dd66
Contents?: true
Size: 885 Bytes
Versions: 2
Compression:
Stored size: 885 Bytes
Contents
require 'spec_helper' require 'parser/current' describe Unparser::Comments, '#skip_eol_comment' do let(:ast_and_comments) do Parser::CurrentRuby.parse_with_comments(<<-RUBY) def hi # comment end # comment RUBY end let(:ast) { ast_and_comments[0] } let(:comments) { ast_and_comments[1] } let(:object) { described_class.new(comments) } it 'should skip the specified comment only for one subsequent take' do object.consume(ast, :name) object.skip_eol_comment('# comment') expect(object.take_eol_comments).to eql([]) object.consume(ast, :end) expect(object.take_eol_comments).to eql([comments[1]]) end it 'should not skip comments with different text' do object.skip_eol_comment('# not the comment') object.consume(ast, :end) expect(object.take_eol_comments).to eql(comments) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
unparser-0.1.5 | spec/unit/unparser/comments/skip_eol_comment_spec.rb |
unparser-0.1.4 | spec/unit/unparser/comments/skip_eol_comment_spec.rb |