summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/t/exception.rb16
-rw-r--r--test/t/kernel.rb11
-rw-r--r--test/t/struct.rb6
3 files changed, 31 insertions, 2 deletions
diff --git a/test/t/exception.rb b/test/t/exception.rb
index 0aed0e2e6..2ea319caa 100644
--- a/test/t/exception.rb
+++ b/test/t/exception.rb
@@ -253,3 +253,19 @@ assert('Exception 13') do
end
a == :ok
end
+
+def exception_test14
+ UnknownConstant
+end
+
+assert('Exception 14') do
+ a = :ng
+ begin
+ send(:exception_test14)
+ rescue
+ a = :ok
+ end
+
+ a == :ok
+end
+
diff --git a/test/t/kernel.rb b/test/t/kernel.rb
index b96e85134..59d9f3df5 100644
--- a/test/t/kernel.rb
+++ b/test/t/kernel.rb
@@ -213,11 +213,18 @@ assert('Kernel#hash', '15.3.1.3.15') do
end
assert('Kernel#inspect', '15.3.1.3.17') do
- inspect.class == String
+ s = nil.inspect
+ s.class == String and s == "nil"
end
assert('Kernel#instance_variables', '15.3.1.3.23') do
- instance_variables.class == Array
+ o = Object.new
+ o.instance_eval do
+ @a = 11
+ @b = 12
+ end
+ ivars = o.instance_variables
+ ivars.class == Array and ivars.size == 2 and ivars.include?(:@a) and ivars.include?(:@b)
end
assert('Kernel#is_a?', '15.3.1.3.24') do
diff --git a/test/t/struct.rb b/test/t/struct.rb
index 5cf6929b8..d79b30c0e 100644
--- a/test/t/struct.rb
+++ b/test/t/struct.rb
@@ -16,6 +16,12 @@ if Object.const_defined?(:Struct)
c.members == [:m1,:m2]
end
+ # Check crash bug with Struc.new and no params.
+ assert('Struct.new', '15.2.18.3.1') do
+ c = Struct.new()
+ c.superclass == Struct and c.members == []
+ end
+
assert('Struct#==', '15.2.18.4.1') do
c = Struct.new(:m1, :m2)
cc1 = c.new(1,2)