Sha256: 265ca5d4ea3402038ed36ab8b733de835c06f2edfbfa0d15404d0f6de0322a34

Contents?: true

Size: 763 Bytes

Versions: 2

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

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

  Dir.glob('test/ripper_ruby_parser/**/*.rb').each do |file|
    describe "for #{file}" do
      let :program do
        File.read file
      end

      it 'gives the same result' do
        # Clone string because ruby_parser destroys it when there's a heredoc
        # inside.
        copy = program.clone
        original = oldparser.parse program
        imitation = newparser.parse copy

        formatted(imitation).must_equal formatted(original)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ripper_ruby_parser-1.5.1 test/end_to_end/test_comparison_test.rb
ripper_ruby_parser-1.5.0 test/end_to_end/test_comparison_test.rb