Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
9007aafe
Commit
9007aafe
authored
Dec 31, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1630 from carsonmcdonald/morekerneltests
More kernel testing
parents
ca642dd3
60cd1c34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
1 deletion
+75
-1
test/t/kernel.rb
test/t/kernel.rb
+75
-1
No files found.
test/t/kernel.rb
View file @
9007aafe
...
@@ -325,6 +325,57 @@ assert('Kernel#loop', '15.3.1.3.29') do
...
@@ -325,6 +325,57 @@ assert('Kernel#loop', '15.3.1.3.29') do
assert_equal
i
,
100
assert_equal
i
,
100
end
end
assert
(
'Kernel#method_missing'
,
'15.3.1.3.30'
)
do
class
MMTestClass
def
method_missing
(
sym
)
"A call to
#{
sym
}
"
end
end
mm_test
=
MMTestClass
.
new
assert_equal
'A call to no_method_named_this'
,
mm_test
.
no_method_named_this
a
=
String
.
new
begin
a
.
no_method_named_this
rescue
NoMethodError
=>
e
assert_equal
"undefined method 'no_method_named_this' for
\"\"
"
,
e
.
message
end
class
ShortInspectClass
def
inspect
'An inspect string'
end
end
b
=
ShortInspectClass
.
new
begin
b
.
no_method_named_this
rescue
NoMethodError
=>
e
assert_equal
"undefined method 'no_method_named_this' for An inspect string"
,
e
.
message
end
class
LongInspectClass
def
inspect
"A"
*
70
end
end
c
=
LongInspectClass
.
new
begin
c
.
no_method_named_this
rescue
NoMethodError
=>
e
assert_equal
"undefined method 'no_method_named_this' for
#{
c
.
to_s
}
"
,
e
.
message
end
class
NoInspectClass
undef
inspect
end
d
=
NoInspectClass
.
new
begin
d
.
no_method_named_this
rescue
NoMethodError
=>
e
assert_equal
"undefined method 'no_method_named_this' for
#{
d
.
to_s
}
"
,
e
.
message
end
end
assert
(
'Kernel#methods'
,
'15.3.1.3.31'
)
do
assert
(
'Kernel#methods'
,
'15.3.1.3.31'
)
do
assert_equal
Array
,
methods
.
class
assert_equal
Array
,
methods
.
class
end
end
...
@@ -334,7 +385,18 @@ assert('Kernel#nil?', '15.3.1.3.32') do
...
@@ -334,7 +385,18 @@ assert('Kernel#nil?', '15.3.1.3.32') do
end
end
assert
(
'Kernel#object_id'
,
'15.3.1.3.33'
)
do
assert
(
'Kernel#object_id'
,
'15.3.1.3.33'
)
do
assert_equal
Fixnum
,
object_id
.
class
a
=
""
b
=
""
assert_not_equal
a
.
object_id
,
b
.
object_id
assert_kind_of
Fixnum
,
object_id
assert_kind_of
Fixnum
,
""
.
object_id
assert_kind_of
Fixnum
,
true
.
object_id
assert_kind_of
Fixnum
,
false
.
object_id
assert_kind_of
Fixnum
,
nil
.
object_id
assert_kind_of
Fixnum
,
:
no
.
object_id
assert_kind_of
Fixnum
,
1
.
object_id
assert_kind_of
Fixnum
,
1.0
.
object_id
end
end
# Kernel#p is defined in mruby-print mrbgem. '15.3.1.3.34'
# Kernel#p is defined in mruby-print mrbgem. '15.3.1.3.34'
...
@@ -427,3 +489,15 @@ assert('Kernel#respond_to_missing?') do
...
@@ -427,3 +489,15 @@ assert('Kernel#respond_to_missing?') do
assert_true
Test4RespondToMissing
.
new
.
respond_to?
(
:a_method
)
assert_true
Test4RespondToMissing
.
new
.
respond_to?
(
:a_method
)
assert_false
Test4RespondToMissing
.
new
.
respond_to?
(
:no_method
)
assert_false
Test4RespondToMissing
.
new
.
respond_to?
(
:no_method
)
end
end
assert
(
'stack extend'
)
do
def
recurse
(
count
,
stop
)
return
count
if
count
>
stop
recurse
(
count
+
1
,
stop
)
end
assert_equal
61
,
recurse
(
0
,
60
)
assert_raise
RuntimeError
do
recurse
(
0
,
100000
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment