summaryrefslogtreecommitdiffhomepage
path: root/test/t/nameerror.rb
blob: 30da74a15ee9a15ef6fc6d705514dbe2841c2e26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
##
# NameError ISO Test

assert('NameError', '15.2.31') do
  NameError.class == Class
end

assert('NameError superclass', '15.2.31.2') do
  NameError.superclass == StandardError
end

assert('NameError#name', '15.2.31.2.1') do

  # This check is not duplicate with 15.2.31.2.2 check.
  # Because the NameError in this test is generated in
  # C API.
  class TestDummy
    alias foo bar
  rescue NameError => e
    $test_dummy_result = e.name
  end

  $test_dummy_result == :bar
end

assert('NameError#initialize', '15.2.31.2.2') do
   e = NameError.new('a', :foo)

   e.class == NameError and
   e.message == 'a' and
   e.name == :foo
end