Skip to content

Commit f8b33f3

Browse files
committed
Use host_os in RbConfig instead of RUBY_PLATFORM for JRuby
1 parent ad92638 commit f8b33f3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/io/console/test_io_console.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
end
88

99
class TestIO_Console < Test::Unit::TestCase
10+
HOST_OS = RbConfig::CONFIG['host_os']
11+
private def host_os?(os)
12+
HOST_OS =~ os
13+
end
14+
1015
begin
1116
PATHS = $LOADED_FEATURES.grep(%r"/io/console(?:\.#{RbConfig::CONFIG['DLEXT']}|\.rb|/\w+\.rb)\z") {$`}
1217
rescue Encoding::CompatibilityError
@@ -26,7 +31,7 @@ class TestIO_Console < Test::Unit::TestCase
2631
# But it does not occur in `make test-all > /dev/null`, so
2732
# there should be an additional factor, I guess.
2833
def set_winsize_setup
29-
@old_ttou = trap(:TTOU, 'IGNORE') if RUBY_PLATFORM =~ /freebsd/i
34+
@old_ttou = trap(:TTOU, 'IGNORE') if host_os?(/freebsd/)
3035
end
3136

3237
def set_winsize_teardown
@@ -387,7 +392,7 @@ def test_intr
387392
# TestIO_Console#test_intr [/usr/home/chkbuild/chkbuild/tmp/build/20220304T163001Z/ruby/test/io/console/test_io_console.rb:387]:
388393
# <"25"> expected but was
389394
# <"-e:12:in `p': \e[1mexecution expired (\e[1;4mTimeout::Error\e[m\e[1m)\e[m">.
390-
omit if /freebsd/ =~ RUBY_PLATFORM
395+
omit if host_os?(/freebsd/)
391396

392397
run_pty("#{<<~"begin;"}\n#{<<~'end;'}") do |r, w, _|
393398
begin;
@@ -413,7 +418,7 @@ def test_intr
413418
if cc = ctrl["intr"]
414419
assert_ctrl("#{cc.ord}", cc, r, w)
415420
assert_ctrl("#{cc.ord}", cc, r, w)
416-
assert_ctrl("Interrupt", cc, r, w) unless /linux/ =~ RUBY_PLATFORM
421+
assert_ctrl("Interrupt", cc, r, w) unless host_os?(/linux/)
417422
end
418423
if cc = ctrl["dsusp"]
419424
assert_ctrl("#{cc.ord}", cc, r, w)

0 commit comments

Comments
 (0)