Sha256: 893921f75ad85deded2740061b155b71b3c4025cc6b8a3434359478c96d73dee

Contents?: true

Size: 1.07 KB

Versions: 51

Compression:

Stored size: 1.07 KB

Contents

require 'pathname'
require 'fileutils'
require 'shellwords'

BASE_DIR = Pathname.new(__FILE__) + '../..'
require (BASE_DIR + 'helper').expand_path

class TestRunnerRewrite < Minitest::Test
  def setup
    @ruby_rewrite = BASE_DIR.expand_path + '../bin/ruby-rewrite'
    @test_dir     = BASE_DIR + 'bug_163'
    @fixtures_dir = @test_dir + 'fixtures'
  end

  def test_rewriter
    Dir.mktmpdir("parser", BASE_DIR.expand_path.to_s) do |tmp_dir|
      tmp_dir = Pathname.new(tmp_dir)
      sample_file = tmp_dir + 'bug_163.rb'
      sample_file_expanded = sample_file.expand_path
      expected_file = @fixtures_dir + 'output.rb'

      FileUtils.cp(@fixtures_dir + 'input.rb', tmp_dir + 'bug_163.rb')
      FileUtils.cd @test_dir do
        exit_code = system %Q{
          #{Shellwords.escape(@ruby_rewrite.to_s)} --modify \
            -l rewriter.rb \
            #{Shellwords.escape(sample_file_expanded.to_s)}
        }
      end

      assert File.read(expected_file.expand_path) == File.read(sample_file),
        "#{sample_file} should be identical to #{expected_file}"
    end
  end
end

Version data entries

51 entries across 51 versions & 4 rubygems

Version Path
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/test/bug_163/test_runner_rewrite.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/test/bug_163/test_runner_rewrite.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/bug_163/test_runner_rewrite.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/bug_163/test_runner_rewrite.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/bug_163/test_runner_rewrite.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/bug_163/test_runner_rewrite.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.0/test/bug_163/test_runner_rewrite.rb
parser-2.4.0.2 test/bug_163/test_runner_rewrite.rb
parser-2.4.0.1 test/bug_163/test_runner_rewrite.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/test/bug_163/test_runner_rewrite.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/test/bug_163/test_runner_rewrite.rb
parser-2.4.0.0 test/bug_163/test_runner_rewrite.rb
parser-2.3.3.1 test/bug_163/test_runner_rewrite.rb
parser-2.3.3.0 test/bug_163/test_runner_rewrite.rb
parser-2.3.2.0 test/bug_163/test_runner_rewrite.rb
parser-2.3.1.4 test/bug_163/test_runner_rewrite.rb
parser-2.3.1.3 test/bug_163/test_runner_rewrite.rb
erruby_parser-2.3.1.2 test/bug_163/test_runner_rewrite.rb
parser-2.3.1.2 test/bug_163/test_runner_rewrite.rb
parser-2.3.1.1 test/bug_163/test_runner_rewrite.rb