ruby-changes:56147
From: Hiroshi <ko1@a...>
Date: Wed, 19 Jun 2019 18:37:27 +0900 (JST)
Subject: [ruby-changes:56147] Hiroshi SHIBATA: 4cca8c4d20 (trunk): Use Test::Unit instead of Minitest and fixed test error with ruby repo.
https://git.ruby-lang.org/ruby.git/commit/?id=4cca8c4d20 From 4cca8c4d2021c90e351d0ee9000d448a9ed85e83 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Sun, 2 Jun 2019 14:11:24 +0300 Subject: Use Test::Unit instead of Minitest and fixed test error with ruby repo. Co-authored-by: Nobuyoshi Nakada <nobu@r...> diff --git a/lib/racc/grammarfileparser.rb b/lib/racc/grammarfileparser.rb index 7548a9e..37b8c37 100644 --- a/lib/racc/grammarfileparser.rb +++ b/lib/racc/grammarfileparser.rb @@ -295,7 +295,7 @@ module Racc https://github.com/ruby/ruby/blob/trunk/lib/racc/grammarfileparser.rb#L295 class GrammarFileScanner def initialize(str, filename = '-') - @lines = str.split(/\n|\r\n|\r/) + @lines = str.b.split(/\n|\r\n|\r/) @filename = filename @lineno = -1 @line_head = true diff --git a/test/racc/helper.rb b/test/racc/helper.rb index 4695b61..2c9c3fc 100644 --- a/test/racc/helper.rb +++ b/test/racc/helper.rb @@ -6,7 +6,7 @@ require 'tempfile' https://github.com/ruby/ruby/blob/trunk/test/racc/helper.rb#L6 require 'timeout' module Racc - class TestCase < MiniTest::Unit::TestCase + class TestCase < Test::Unit::TestCase PROJECT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..')) test_dir = File.join(PROJECT_DIR, 'test') @@ -48,7 +48,7 @@ module Racc https://github.com/ruby/ruby/blob/trunk/test/racc/helper.rb#L48 "-O#{OUT_DIR}/#{file}", "-o#{TAB_DIR}/#{file}", ] - racc "#{args.join(' ')}" + racc *args end def assert_debugfile(asset, ok) @@ -71,9 +71,7 @@ module Racc https://github.com/ruby/ruby/blob/trunk/test/racc/helper.rb#L71 def assert_exec(asset) file = File.basename(asset, '.y') - Dir.chdir(TEST_DIR) do - ruby("#{TAB_DIR}/#{file}") - end + ruby("#{TAB_DIR}/#{file}") end def strip_version(source) @@ -91,18 +89,12 @@ module Racc https://github.com/ruby/ruby/blob/trunk/test/racc/helper.rb#L89 "expectation. Try compiling it and diff with test/regress/#{file}.") end - def racc(arg) - ruby "-S #{RACC} #{arg}" + def racc(*arg) + ruby "-S", RACC, *arg end - def ruby(arg) - Dir.chdir(TEST_DIR) do - Tempfile.open 'test' do |io| - cmd = "#{ENV['_'] || Gem.ruby} -I #{INC} #{arg} 2>#{io.path}" - result = system(cmd) - assert(result, io.read) - end - end + def ruby(*arg) + assert_ruby_status(["-C", TEST_DIR, *arg]) end end end diff --git a/test/racc/test_racc_command.rb b/test/racc/test_racc_command.rb index 1fc5413..2409bb3 100644 --- a/test/racc/test_racc_command.rb +++ b/test/racc/test_racc_command.rb @@ -141,13 +141,13 @@ module Racc https://github.com/ruby/ruby/blob/trunk/test/racc/test_racc_command.rb#L141 end def test_norule_y - assert_raises(MiniTest::Assertion) { + assert_raise(MiniTest::Assertion) { assert_compile 'norule.y' } end def test_unterm_y - assert_raises(MiniTest::Assertion) { + assert_raise(MiniTest::Assertion) { assert_compile 'unterm.y' } end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/