summaryrefslogtreecommitdiff
path: root/test/racc
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-10-30 21:38:55 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-10-31 08:39:48 +0900
commit1c03026ea3cd90cbc37eb4c612aca3c6129032c8 (patch)
tree88ed03fb0859a39f4ddb2a8c9c8f2c4db1e4d2f4 /test/racc
parent5f8795a07b163fe3f373ad443db1949de21c747b (diff)
downloadbundler-1c03026ea3cd90cbc37eb4c612aca3c6129032c8.tar.gz
Try to run assert_output_unchanged with racc tests
Diffstat (limited to 'test/racc')
-rw-r--r--test/racc/helper.rb16
-rw-r--r--test/racc/test_racc_command.rb44
2 files changed, 35 insertions, 25 deletions
diff --git a/test/racc/helper.rb b/test/racc/helper.rb
index 744c0a7f2e..d05ba4abfc 100644
--- a/test/racc/helper.rb
+++ b/test/racc/helper.rb
@@ -2,7 +2,12 @@ verbose = $VERBOSE
$VERBOSE = true
begin
-require 'minitest/autorun'
+require 'test/unit'
+begin
+ require_relative './lib/core_assertions'
+ Test::Unit::TestCase.include Test::Unit::CoreAssertions
+rescue LoadError
+end
require 'racc/static'
require 'fileutils'
require 'tempfile'
@@ -71,8 +76,9 @@ module Racc
end
def assert_exec(asset)
+ lib_path = File.expand_path("../../lib", __FILE__)
file = File.basename(asset, '.y')
- ruby("#{@TAB_DIR}/#{file}")
+ ruby "-I#{lib_path}", "#{@TAB_DIR}/#{file}"
end
def strip_version(source)
@@ -80,6 +86,9 @@ module Racc
end
def assert_output_unchanged(asset)
+ # racc generates the difference results in GitHub Actions
+ omit if ENV['GITHUB_ACTION']
+
file = File.basename(asset, '.y')
expected = File.read("#{REGRESS_DIR}/#{file}")
@@ -91,7 +100,8 @@ module Racc
end
def racc(*arg, **opt)
- ruby "-S", RACC, *arg, **opt
+ lib_path = File.expand_path("../../lib", __FILE__)
+ ruby "-I#{lib_path}", "-S", RACC, *arg, **opt
end
def ruby(*arg, **opt)
diff --git a/test/racc/test_racc_command.rb b/test/racc/test_racc_command.rb
index fcbe8471e7..b4fc0c6745 100644
--- a/test/racc/test_racc_command.rb
+++ b/test/racc/test_racc_command.rb
@@ -141,13 +141,13 @@ module Racc
end
def test_norule_y
- assert_raise(MiniTest::Assertion) {
+ assert_raise(Test::Unit::AssertionFailedError) {
assert_compile 'norule.y'
}
end
def test_unterm_y
- assert_raise(MiniTest::Assertion) {
+ assert_raise(Test::Unit::AssertionFailedError) {
assert_compile 'unterm.y'
}
end
@@ -166,13 +166,13 @@ module Racc
def test_ruby18
assert_compile 'ruby18.y', [], timeout: 60
assert_debugfile 'ruby18.y', []
- # assert_output_unchanged 'ruby18.y'
+ assert_output_unchanged 'ruby18.y'
end
def test_ruby22
assert_compile 'ruby22.y', [], timeout: 60
assert_debugfile 'ruby22.y', []
- # assert_output_unchanged 'ruby22.y'
+ assert_output_unchanged 'ruby22.y'
end
# .y file from csspool gem
@@ -180,7 +180,7 @@ module Racc
def test_csspool
assert_compile 'csspool.y'
assert_debugfile 'csspool.y', [5, 3]
- # assert_output_unchanged 'csspool.y'
+ assert_output_unchanged 'csspool.y'
end
# .y file from opal gem
@@ -188,7 +188,7 @@ module Racc
def test_opal
assert_compile 'opal.y', [], timeout: 60
assert_debugfile 'opal.y', []
- # assert_output_unchanged 'opal.y'
+ assert_output_unchanged 'opal.y'
end
# .y file from journey gem
@@ -196,7 +196,7 @@ module Racc
def test_journey
assert_compile 'journey.y'
assert_debugfile 'journey.y', []
- # assert_output_unchanged 'journey.y'
+ assert_output_unchanged 'journey.y'
end
# .y file from nokogiri gem
@@ -204,7 +204,7 @@ module Racc
def test_nokogiri_css
assert_compile 'nokogiri-css.y'
assert_debugfile 'nokogiri-css.y', [0, 1]
- # assert_output_unchanged 'nokogiri-css.y'
+ assert_output_unchanged 'nokogiri-css.y'
end
# .y file from edtf-ruby gem
@@ -212,7 +212,7 @@ module Racc
def test_edtf
assert_compile 'edtf.y'
assert_debugfile 'edtf.y', [0, 0, 0, 0, 0]
- # assert_output_unchanged 'edtf.y'
+ assert_output_unchanged 'edtf.y'
end
# .y file from namae gem
@@ -220,7 +220,7 @@ module Racc
def test_namae
assert_compile 'namae.y'
assert_debugfile 'namae.y', [0, 0, 0, 0, 0]
- # assert_output_unchanged 'namae.y'
+ assert_output_unchanged 'namae.y'
end
# .y file from liquor gem
@@ -228,7 +228,7 @@ module Racc
def test_liquor
assert_compile 'liquor.y'
assert_debugfile 'liquor.y', [0, 0, 0, 0, 15]
- # assert_output_unchanged 'liquor.y'
+ assert_output_unchanged 'liquor.y'
end
# .y file from nasl gem
@@ -236,7 +236,7 @@ module Racc
def test_nasl
assert_compile 'nasl.y'
assert_debugfile 'nasl.y', [0, 0, 0, 0, 1]
- # assert_output_unchanged 'nasl.y'
+ assert_output_unchanged 'nasl.y'
end
# .y file from riml gem
@@ -244,7 +244,7 @@ module Racc
def test_riml
assert_compile 'riml.y'
assert_debugfile 'riml.y', [289, 0, 0, 0]
- # assert_output_unchanged 'riml.y'
+ assert_output_unchanged 'riml.y'
end
# .y file from ruby-php-serialization gem
@@ -252,7 +252,7 @@ module Racc
def test_php_serialization
assert_compile 'php_serialization.y'
assert_debugfile 'php_serialization.y', [0, 0, 0, 0]
- # assert_output_unchanged 'php_serialization.y'
+ assert_output_unchanged 'php_serialization.y'
end
# .y file from huia language implementation
@@ -260,7 +260,7 @@ module Racc
def test_huia
assert_compile 'huia.y'
assert_debugfile 'huia.y', [285, 0, 0, 0]
- # assert_output_unchanged 'huia.y'
+ assert_output_unchanged 'huia.y'
end
# .y file from cast gem
@@ -268,7 +268,7 @@ module Racc
def test_cast
assert_compile 'cast.y'
assert_debugfile 'cast.y', [0, 0, 0, 0, 1]
- # assert_output_unchanged 'cast.y'
+ assert_output_unchanged 'cast.y'
end
# .y file from cadenza gem
@@ -276,7 +276,7 @@ module Racc
def test_cadenza
assert_compile 'cadenza.y'
assert_debugfile 'cadenza.y', [0, 0, 0, 0, 37]
- # assert_output_unchanged 'cadenza.y'
+ assert_output_unchanged 'cadenza.y'
end
# .y file from mediacloth gem
@@ -284,7 +284,7 @@ module Racc
def test_mediacloth
assert_compile 'mediacloth.y'
assert_debugfile 'mediacloth.y', [0, 0, 0, 0]
- # assert_output_unchanged 'mediacloth.y'
+ assert_output_unchanged 'mediacloth.y'
end
# .y file from twowaysql gem
@@ -292,7 +292,7 @@ module Racc
def test_twowaysql
assert_compile 'twowaysql.y'
assert_debugfile 'twowaysql.y', [4, 0, 0, 0]
- # assert_output_unchanged 'twowaysql.y'
+ assert_output_unchanged 'twowaysql.y'
end
# .y file from machete gem
@@ -300,7 +300,7 @@ module Racc
def test_machete
assert_compile 'machete.y'
assert_debugfile 'machete.y', [0, 0, 0, 0]
- # assert_output_unchanged 'machete.y'
+ assert_output_unchanged 'machete.y'
end
# .y file from mof gem
@@ -308,7 +308,7 @@ module Racc
def test_mof
assert_compile 'mof.y'
assert_debugfile 'mof.y', [7, 4, 0, 0]
- # assert_output_unchanged 'mof.y'
+ assert_output_unchanged 'mof.y'
end
# .y file from tp_plus gem
@@ -316,7 +316,7 @@ module Racc
def test_tp_plus
assert_compile 'tp_plus.y'
assert_debugfile 'tp_plus.y', [21, 0, 0, 0]
- # assert_output_unchanged 'tp_plus.y'
+ assert_output_unchanged 'tp_plus.y'
end
end
end