Sha256: 8d840c10753a3b1ebdfc6f4479957ea9e785fd57e1e9bd5b432e0b9f89284d40

Contents?: true

Size: 1014 Bytes

Versions: 7

Compression:

Stored size: 1014 Bytes

Contents

require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
require 'ruby_parser'

describe "Using RipperRubyParser and RubyParser" do
  let :newparser do
    RipperRubyParser::Parser.new
  end

  let :oldparser do
    RubyParser.new
  end

  describe "for a program with quite some comments" do
    let :program do
      <<-END
      # Foo
      class Foo
        # The foo
        # method
        def foo
          bar # bar
          # internal comment
        end

        def bar
          baz
        end
      end
      # Quux
      module Qux
        class Quux
          def bar
          end
          def baz
          end
        end
      end
      END
    end

    let :original do
      oldparser.parse program
    end

    let :imitation do
      newparser.parse program
    end

    it "gives the same result" do
      imitation.must_equal original
    end

    it "gives the same result with comments" do
      to_comments(imitation).must_equal to_comments(original)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ripper_ruby_parser-1.1.1 test/end_to_end/comments_test.rb
ripper_ruby_parser-1.1.0 test/end_to_end/comments_test.rb
ripper_ruby_parser-1.0.0 test/end_to_end/comments_test.rb
ripper_ruby_parser-0.0.8 test/end_to_end/comments_test.rb
ripper_ruby_parser-0.0.7 test/end_to_end/comments_test.rb
ripper_ruby_parser-0.0.6 test/end_to_end/comments_test.rb
ripper_ruby_parser-0.0.5 test/end_to_end/comments_test.rb