test/-ext-/load/test_protect.rb
raw| 1 | # frozen_string_literal: true |
| 2 | require 'test/unit' |
| 3 | require '-test-/load/protect' |
| 4 | |
| 5 | class Test_Load_Protect < Test::Unit::TestCase |
| 6 | def test_load_protect |
| 7 | assert_raise(LoadError) { |
| 8 | Bug.load_protect(__dir__+"/nonexistent.rb") |
| 9 | } |
| 10 | assert_raise_with_message(RuntimeError, "foo") { |
| 11 | Bug.load_protect(__dir__+"/script.rb") |
| 12 | } |
| 13 | end |
| 14 | end |