Skip to content

Commit 6fdf4f3

Browse files
st0012nirvdrum
andauthored
Make tests more compatible with TruffleRuby (#514)
* Improve encoding error test case The test input IRB currently uses happen to hit a compatibility bug in TruffleRuby, which has been documented in truffleruby/truffleruby#2848 Although it'll eventually be fixed, we can make the test case support TruffleRuby now by tweaking it just a little bit. Co-authored-by: Kevin Menard <kevin@nirvdrum.com> * Remove redundant TruffleRuby omits/pends Co-authored-by: Kevin Menard <kevin@nirvdrum.com> * Use a different way to test warning emission The test case was added in d08ef68 to verify that IRB emits Ruby warning as expected. But the subject it uses relies on CRuby's regexp engine, which isn't always used in other language implementations, like TruffleRuby. That's why we ended up skipping TruffleRuby in this test case. Since the test isn't about regexp itself, we can change the testing subject and just remove the special condition for TruffleRuby. Co-authored-by: Kevin Menard <kevin@nirvdrum.com> --------- Co-authored-by: Kevin Menard <kevin@nirvdrum.com>
1 parent 874dbca commit 6fdf4f3

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

‎test/irb/test_context.rb‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,19 @@ def test_evaluate_with_exception
5050
end
5151

5252
deftest_evaluate_with_encoding_error_without_lineno
53-
pendifRUBY_ENGINE == 'truffleruby'
5453
assert_raise_with_message(EncodingError,/invalid symbol/){
55-
@context.evaluate(%q[{"\xAE": 1}],1)
54+
@context.evaluate(%q[:"\xAE"],1)
5655
# The backtrace of this invalid encoding hash doesn't contain lineno.
5756
}
5857
end
5958

60-
deftest_evaluate_with_onigmo_warning
61-
pendifRUBY_ENGINE == 'truffleruby'
62-
assert_warning("(irb):1: warning: character class has duplicated range: /[aa]/\n")do
63-
@context.evaluate('/[aa]/',1)
59+
deftest_evaluate_still_emits_warning
60+
assert_warning("(irb):1: warning: END in method; use at_exit\n")do
61+
@context.evaluate(%q[def foo; END {}; end],1)
6462
end
6563
end
6664

6765
deftest_eval_input
68-
pendifRUBY_ENGINE == 'truffleruby'
6966
verbose, $VERBOSE = $VERBOSE,nil
7067
input=TestInputMethod.new([
7168
"raise 'Foo'\n",
@@ -88,7 +85,6 @@ def test_eval_input
8885
end
8986

9087
deftest_eval_input_raise2x
91-
pendifRUBY_ENGINE == 'truffleruby'
9288
input=TestInputMethod.new([
9389
"raise 'Foo'\n",
9490
"raise 'Bar'\n",
@@ -513,7 +509,6 @@ def test_eval_input_with_exception
513509
end
514510

515511
deftest_eval_input_with_invalid_byte_sequence_exception
516-
pendifRUBY_ENGINE == 'truffleruby'
517512
verbose, $VERBOSE = $VERBOSE,nil
518513
input=TestInputMethod.new([
519514
%Q{def hoge() fuga; end; def fuga() raise "A\\xF3B"; end; hoge\n},

0 commit comments

Comments
 (0)