diff options
Diffstat (limited to 'test/ostruct/test_ostruct.rb')
-rw-r--r-- | test/ostruct/test_ostruct.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 256db7a0c7..19bb606145 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -412,4 +412,23 @@ class TC_OpenStruct < Test::Unit::TestCase assert_equal('my-class', os.class) assert_equal(OpenStruct, os.class!) end + + has_performance_warnings = begin + Warning[:performance] + true + rescue NoMethodError, ArgumentError + false + end + + if has_performance_warnings + def test_performance_warning + assert_in_out_err( + %w(-Ilib -rostruct -w -W:performance -e) + ['OpenStruct.new(a: 1)'], + "", + [], + ["-e:1: warning: OpenStruct use is discouraged for performance reasons"], + success: true, + ) + end + end end |