From 4e5754a459ea10c73381b3009bb889e83077575c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 14 Jan 2024 00:24:14 +0900 Subject: [PATCH] Add test for `Errno` constants --- test/ruby/test_exception.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index b3951c7e513817..84c750bf329e8a 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -540,6 +540,14 @@ def test_errno assert_equal(Encoding.find("locale"), Errno::EINVAL.new.message.encoding) end + def test_errno_constants + assert_equal [:NOERROR], Errno.constants.grep_v(/\AE/) + all_assertions_foreach("should be a subclass of SystemCallError", *Errno.constants) do |c| + e = Errno.const_get(c) + assert_operator e, :<, SystemCallError, proc {e.ancestors.inspect} + end + end + def test_too_many_args_in_eval bug5720 = '[ruby-core:41520]' arg_string = (0...140000).to_a.join(", ")