mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Use Test::Unit instead of Minitest and fixed test error with ruby repo.
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
parent
2272d6ae24
commit
4cca8c4d20
3 changed files with 10 additions and 18 deletions
|
@ -295,7 +295,7 @@ module Racc
|
||||||
class GrammarFileScanner
|
class GrammarFileScanner
|
||||||
|
|
||||||
def initialize(str, filename = '-')
|
def initialize(str, filename = '-')
|
||||||
@lines = str.split(/\n|\r\n|\r/)
|
@lines = str.b.split(/\n|\r\n|\r/)
|
||||||
@filename = filename
|
@filename = filename
|
||||||
@lineno = -1
|
@lineno = -1
|
||||||
@line_head = true
|
@line_head = true
|
||||||
|
|
|
@ -6,7 +6,7 @@ require 'tempfile'
|
||||||
require 'timeout'
|
require 'timeout'
|
||||||
|
|
||||||
module Racc
|
module Racc
|
||||||
class TestCase < MiniTest::Unit::TestCase
|
class TestCase < Test::Unit::TestCase
|
||||||
PROJECT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
PROJECT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||||
|
|
||||||
test_dir = File.join(PROJECT_DIR, 'test')
|
test_dir = File.join(PROJECT_DIR, 'test')
|
||||||
|
@ -48,7 +48,7 @@ module Racc
|
||||||
"-O#{OUT_DIR}/#{file}",
|
"-O#{OUT_DIR}/#{file}",
|
||||||
"-o#{TAB_DIR}/#{file}",
|
"-o#{TAB_DIR}/#{file}",
|
||||||
]
|
]
|
||||||
racc "#{args.join(' ')}"
|
racc *args
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_debugfile(asset, ok)
|
def assert_debugfile(asset, ok)
|
||||||
|
@ -71,9 +71,7 @@ module Racc
|
||||||
|
|
||||||
def assert_exec(asset)
|
def assert_exec(asset)
|
||||||
file = File.basename(asset, '.y')
|
file = File.basename(asset, '.y')
|
||||||
Dir.chdir(TEST_DIR) do
|
ruby("#{TAB_DIR}/#{file}")
|
||||||
ruby("#{TAB_DIR}/#{file}")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def strip_version(source)
|
def strip_version(source)
|
||||||
|
@ -91,18 +89,12 @@ module Racc
|
||||||
"expectation. Try compiling it and diff with test/regress/#{file}.")
|
"expectation. Try compiling it and diff with test/regress/#{file}.")
|
||||||
end
|
end
|
||||||
|
|
||||||
def racc(arg)
|
def racc(*arg)
|
||||||
ruby "-S #{RACC} #{arg}"
|
ruby "-S", RACC, *arg
|
||||||
end
|
end
|
||||||
|
|
||||||
def ruby(arg)
|
def ruby(*arg)
|
||||||
Dir.chdir(TEST_DIR) do
|
assert_ruby_status(["-C", TEST_DIR, *arg])
|
||||||
Tempfile.open 'test' do |io|
|
|
||||||
cmd = "#{ENV['_'] || Gem.ruby} -I #{INC} #{arg} 2>#{io.path}"
|
|
||||||
result = system(cmd)
|
|
||||||
assert(result, io.read)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -141,13 +141,13 @@ module Racc
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_norule_y
|
def test_norule_y
|
||||||
assert_raises(MiniTest::Assertion) {
|
assert_raise(MiniTest::Assertion) {
|
||||||
assert_compile 'norule.y'
|
assert_compile 'norule.y'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_unterm_y
|
def test_unterm_y
|
||||||
assert_raises(MiniTest::Assertion) {
|
assert_raise(MiniTest::Assertion) {
|
||||||
assert_compile 'unterm.y'
|
assert_compile 'unterm.y'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue