33require 'test/unit'
44
55class TestBox < Test ::Unit ::TestCase
6- EXPERIMENTAL_WARNINGS = [
7- " warning: Ruby::Box is experimental, and the behavior may change in the future!" ,
8- " See doc/language/box.md for known issues, etc."
9- ] . join ( " \n " )
6+ EXPERIMENTAL_WARNING_LINE_PATTERNS = [
7+ /ruby( \. exe)?: warning: Ruby::Box is experimental, and the behavior may change in the future!/ ,
8+ %r{ See https://docs.ruby-lang.org/en/(master| \d \. \d )/Ruby/Box.html for known issues, etc.}
9+ ]
1010 ENV_ENABLE_BOX = { 'RUBY_BOX' => '1' , 'TEST_DIR' => __dir__ }
1111
1212 def setup
@@ -650,8 +650,9 @@ def test_prelude_gems_and_loaded_features
650650 end;
651651
652652 # No additional warnings except for experimental warnings
653- assert_includes error . join ( "\n " ) , EXPERIMENTAL_WARNINGS
654653 assert_equal 2 , error . size
654+ assert_match EXPERIMENTAL_WARNING_LINE_PATTERNS [ 0 ] , error [ 0 ]
655+ assert_match EXPERIMENTAL_WARNING_LINE_PATTERNS [ 1 ] , error [ 1 ]
655656
656657 assert_includes output . grep ( /^before:/ ) . join ( "\n " ) , '/bundled_gems.rb'
657658 assert_includes output . grep ( /^before:/ ) . join ( "\n " ) , '/error_highlight.rb'
@@ -672,8 +673,9 @@ def test_prelude_gems_and_loaded_features_with_disable_gems
672673 puts ["after:", $LOADED_FEATURES.select{ it.end_with?("/error_highlight.rb") }&.first].join
673674 end;
674675
675- assert_includes error . join ( "\n " ) , EXPERIMENTAL_WARNINGS
676676 assert_equal 2 , error . size
677+ assert_match EXPERIMENTAL_WARNING_LINE_PATTERNS [ 0 ] , error [ 0 ]
678+ assert_match EXPERIMENTAL_WARNING_LINE_PATTERNS [ 1 ] , error [ 1 ]
677679
678680 refute_includes output . grep ( /^before:/ ) . join ( "\n " ) , '/bundled_gems.rb'
679681 refute_includes output . grep ( /^before:/ ) . join ( "\n " ) , '/error_highlight.rb'
0 commit comments