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
d60362b3
Commit
d60362b3
authored
Jun 16, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1284 from Bovi-Li/improve-test-2
Improve Test Infrastructure (Part 2)
parents
8dcbf5e4
1a6731fb
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
314 additions
and
224 deletions
+314
-224
test/assert.rb
test/assert.rb
+22
-2
test/t/bs_block.rb
test/t/bs_block.rb
+157
-108
test/t/bs_literal.rb
test/t/bs_literal.rb
+9
-9
test/t/float.rb
test/t/float.rb
+47
-25
test/t/gc.rb
test/t/gc.rb
+10
-10
test/t/indexerror.rb
test/t/indexerror.rb
+2
-3
test/t/localjumperror.rb
test/t/localjumperror.rb
+3
-4
test/t/nameerror.rb
test/t/nameerror.rb
+6
-6
test/t/nil.rb
test/t/nil.rb
+10
-6
test/t/nomethoderror.rb
test/t/nomethoderror.rb
+3
-8
test/t/numeric.rb
test/t/numeric.rb
+7
-6
test/t/object.rb
test/t/object.rb
+2
-2
test/t/proc.rb
test/t/proc.rb
+12
-13
test/t/rangeerror.rb
test/t/rangeerror.rb
+2
-3
test/t/runtimeerror.rb
test/t/runtimeerror.rb
+1
-1
test/t/standarderror.rb
test/t/standarderror.rb
+2
-3
test/t/symbol.rb
test/t/symbol.rb
+7
-6
test/t/true.rb
test/t/true.rb
+10
-7
test/t/typeerror.rb
test/t/typeerror.rb
+2
-2
No files found.
test/assert.rb
View file @
d60362b3
...
@@ -99,13 +99,25 @@ def assert_false(ret, msg = nil, diff = nil)
...
@@ -99,13 +99,25 @@ def assert_false(ret, msg = nil, diff = nil)
!
ret
!
ret
end
end
def
assert_equal
(
exp
,
act
,
msg
=
nil
)
def
assert_equal
(
arg1
,
arg2
=
nil
,
arg3
=
nil
)
if
block_given?
exp
,
act
,
msg
=
yield
,
arg1
,
arg2
else
exp
,
act
,
msg
=
arg1
,
arg2
,
arg3
end
msg
=
"Expected to be equal"
unless
msg
msg
=
"Expected to be equal"
unless
msg
diff
=
assertion_diff
(
exp
,
act
)
diff
=
assertion_diff
(
exp
,
act
)
assert_true
(
exp
==
act
,
msg
,
diff
)
assert_true
(
exp
==
act
,
msg
,
diff
)
end
end
def
assert_not_equal
(
exp
,
act
,
msg
=
nil
)
def
assert_not_equal
(
arg1
,
arg2
=
nil
,
arg3
=
nil
)
if
block_given?
exp
,
act
,
msg
=
yield
,
arg1
,
arg2
else
exp
,
act
,
msg
=
arg1
,
arg2
,
arg3
end
msg
=
"Expected to be not equal"
unless
msg
msg
=
"Expected to be not equal"
unless
msg
diff
=
assertion_diff
(
exp
,
act
)
diff
=
assertion_diff
(
exp
,
act
)
assert_false
(
exp
==
act
,
msg
,
diff
)
assert_false
(
exp
==
act
,
msg
,
diff
)
...
@@ -169,6 +181,14 @@ def assert_kind_of(cls, obj, msg = nil)
...
@@ -169,6 +181,14 @@ def assert_kind_of(cls, obj, msg = nil)
assert_true
(
obj
.
kind_of?
(
cls
),
msg
,
diff
)
assert_true
(
obj
.
kind_of?
(
cls
),
msg
,
diff
)
end
end
##
# Fails unless +exp+ is equal to +act+ in terms of a Float
def
assert_float
(
exp
,
act
,
msg
=
nil
)
msg
=
"Float
#{
exp
}
expected to be equal to float
#{
act
}
"
unless
msg
diff
=
assertion_diff
(
exp
,
act
)
assert_true
check_float
(
exp
,
act
),
msg
,
diff
end
##
##
# Report the test result and print all assertions
# Report the test result and print all assertions
# which were reported broken.
# which were reported broken.
...
...
test/t/bs_block.rb
View file @
d60362b3
...
@@ -2,17 +2,19 @@
...
@@ -2,17 +2,19 @@
# Bootstrap tests for blocks
# Bootstrap tests for blocks
assert
(
'BS Block 1'
)
do
assert
(
'BS Block 1'
)
do
1
.
times
{
assert_equal
(
1
)
do
begin
1
.
times
{
a
=
1
begin
ensure
a
=
1
foo
=
nil
ensure
end
foo
=
nil
}
==
1
end
}
end
end
end
assert
(
'BS Block 2'
)
do
assert
(
'BS Block 2'
)
do
[
1
,
2
,
3
].
find
{
|
x
|
x
==
2
}
==
2
assert_equal
[
1
,
2
,
3
].
find
{
|
x
|
x
==
2
},
2
end
end
assert
(
'BS Block 3'
)
do
assert
(
'BS Block 3'
)
do
...
@@ -22,7 +24,7 @@ assert('BS Block 3') do
...
@@ -22,7 +24,7 @@ assert('BS Block 3') do
[
1
,
2
,
3
].
each
(
&
block
)
[
1
,
2
,
3
].
each
(
&
block
)
end
end
end
end
E
.
new
.
find
{
|
x
|
x
==
2
}
==
2
assert_equal
E
.
new
.
find
{
|
x
|
x
==
2
},
2
end
end
assert
(
'BS Block 3'
)
do
assert
(
'BS Block 3'
)
do
...
@@ -30,7 +32,7 @@ assert('BS Block 3') do
...
@@ -30,7 +32,7 @@ assert('BS Block 3') do
for
x
in
[
1
,
2
,
3
]
for
x
in
[
1
,
2
,
3
]
sum
+=
x
sum
+=
x
end
end
sum
==
6
assert_equal
sum
,
6
end
end
assert
(
'BS Block 4'
)
do
assert
(
'BS Block 4'
)
do
...
@@ -38,7 +40,7 @@ assert('BS Block 4') do
...
@@ -38,7 +40,7 @@ assert('BS Block 4') do
for
x
in
(
1
..
5
)
for
x
in
(
1
..
5
)
sum
+=
x
sum
+=
x
end
end
sum
==
15
assert_equal
sum
,
15
end
end
assert
(
'BS Block 5'
)
do
assert
(
'BS Block 5'
)
do
...
@@ -46,37 +48,43 @@ assert('BS Block 5') do
...
@@ -46,37 +48,43 @@ assert('BS Block 5') do
for
x
in
[]
for
x
in
[]
sum
+=
x
sum
+=
x
end
end
sum
==
0
assert_equal
sum
,
0
end
end
assert
(
'BS Block 6'
)
do
assert
(
'BS Block 6'
)
do
ans
=
[]
ans
=
[]
1
.
times
{
assert_equal
(
1
)
do
for
n
in
1
..
3
1
.
times
{
a
=
n
for
n
in
1
..
3
ans
<<
a
a
=
n
end
ans
<<
a
}
==
1
end
}
end
end
end
assert
(
'BS Block 7'
)
do
assert
(
'BS Block 7'
)
do
ans
=
[]
ans
=
[]
for
m
in
1
..
3
assert_equal
((
1
..
3
))
do
for
n
in
2
..
4
for
m
in
1
..
3
a
=
[
m
,
n
]
for
n
in
2
..
4
ans
<<
a
a
=
[
m
,
n
]
ans
<<
a
end
end
end
end
==
(
1
..
3
)
end
end
end
assert
(
'BS Block 8'
)
do
assert
(
'BS Block 8'
)
do
(
1
..
3
).
to_a
==
[
1
,
2
,
3
]
assert_equal
(
1
..
3
).
to_a
,
[
1
,
2
,
3
]
end
end
assert
(
'BS Block 9'
)
do
assert
(
'BS Block 9'
)
do
(
1
..
3
).
map
{
|
e
|
assert_equal
([
4
,
8
,
12
])
do
e
*
4
(
1
..
3
).
map
{
|
e
|
}
==
[
4
,
8
,
12
]
e
*
4
}
end
end
end
assert
(
'BS Block 10'
)
do
assert
(
'BS Block 10'
)
do
...
@@ -87,11 +95,13 @@ assert('BS Block 10') do
...
@@ -87,11 +95,13 @@ assert('BS Block 10') do
yield
yield
end
end
m
{
assert_equal
(
100
)
do
n
{
m
{
100
n
{
100
}
}
}
}
==
100
end
end
end
assert
(
'BS Block 11'
)
do
assert
(
'BS Block 11'
)
do
...
@@ -99,11 +109,13 @@ assert('BS Block 11') do
...
@@ -99,11 +109,13 @@ assert('BS Block 11') do
yield
1
yield
1
end
end
m
{
|
ib
|
assert_equal
(
20
)
do
m
{
|
jb
|
m
{
|
ib
|
i
=
20
m
{
|
jb
|
i
=
20
}
}
}
}
==
20
end
end
end
assert
(
'BS Block 12'
)
do
assert
(
'BS Block 12'
)
do
...
@@ -111,12 +123,14 @@ assert('BS Block 12') do
...
@@ -111,12 +123,14 @@ assert('BS Block 12') do
yield
1
yield
1
end
end
m
{
|
ib
|
assert_equal
(
2
)
do
m
{
|
jb
|
m
{
|
ib
|
ib
=
20
m
{
|
jb
|
kb
=
2
ib
=
20
kb
=
2
}
}
}
}
==
2
end
end
end
assert
(
'BS Block 13'
)
do
assert
(
'BS Block 13'
)
do
...
@@ -130,13 +144,15 @@ assert('BS Block 13') do
...
@@ -130,13 +144,15 @@ assert('BS Block 13') do
yield
yield
end
end
iter1
{
assert_equal
(
3
)
do
jb
=
2
iter1
{
iter1
{
jb
=
3
jb
=
2
iter1
{
jb
=
3
}
jb
}
}
jb
end
}
==
3
end
end
assert
(
'BS Block 14'
)
do
assert
(
'BS Block 14'
)
do
...
@@ -150,31 +166,37 @@ assert('BS Block 14') do
...
@@ -150,31 +166,37 @@ assert('BS Block 14') do
yield
yield
end
end
iter1
{
assert_equal
(
2
)
do
jb
=
2
iter1
{
iter1
{
jb
=
2
iter1
{
jb
}
jb
jb
}
}
jb
end
}
==
2
end
end
assert
(
'BS Block 15'
)
do
assert
(
'BS Block 15'
)
do
def
m
def
m
yield
1
yield
1
end
end
m
{
|
ib
|
assert_equal
(
2
)
do
ib
*
2
m
{
|
ib
|
}
==
2
ib
*
2
}
end
end
end
assert
(
'BS Block 16'
)
do
assert
(
'BS Block 16'
)
do
def
m
def
m
yield
12345
,
67890
yield
12345
,
67890
end
end
m
{
|
ib
,
jb
|
assert_equal
(
92580
)
do
ib
*
2
+
jb
m
{
|
ib
,
jb
|
}
==
92580
ib
*
2
+
jb
}
end
end
end
assert
(
'BS Block 17'
)
do
assert
(
'BS Block 17'
)
do
...
@@ -183,9 +205,11 @@ assert('BS Block 17') do
...
@@ -183,9 +205,11 @@ assert('BS Block 17') do
end
end
a
=
nil
a
=
nil
[
iter
{
|
a
|
assert_equal
[
10
,
nil
]
do
a
[
iter
{
|
a
|
},
a
]
==
[
10
,
nil
]
a
},
a
]
end
end
end
assert
(
'BS Block 18'
)
do
assert
(
'BS Block 18'
)
do
...
@@ -193,11 +217,13 @@ assert('BS Block 18') do
...
@@ -193,11 +217,13 @@ assert('BS Block 18') do
yield
10
yield
10
end
end
iter
{
|
a
|
assert_equal
(
21
)
do
iter
{
|
a
|
iter
{
|
a
|
a
+
1
iter
{
|
a
|
}
+
a
a
+
1
}
==
21
}
+
a
}
end
end
end
assert
(
'BS Block 19'
)
do
assert
(
'BS Block 19'
)
do
...
@@ -206,9 +232,11 @@ assert('BS Block 19') do
...
@@ -206,9 +232,11 @@ assert('BS Block 19') do
end
end
a
=
b
=
c
=
d
=
nil
a
=
b
=
c
=
d
=
nil
iter
{
|
a
,
b
,
c
,
d
|
assert_equal
([
10
,
20
,
30
,
40
,
nil
,
nil
,
nil
,
nil
])
do
[
a
,
b
,
c
,
d
]
iter
{
|
a
,
b
,
c
,
d
|
}
+
[
a
,
b
,
c
,
d
]
==
[
10
,
20
,
30
,
40
,
nil
,
nil
,
nil
,
nil
]
[
a
,
b
,
c
,
d
]
}
+
[
a
,
b
,
c
,
d
]
end
end
end
assert
(
'BS Block 20'
)
do
assert
(
'BS Block 20'
)
do
...
@@ -217,9 +245,11 @@ assert('BS Block 20') do
...
@@ -217,9 +245,11 @@ assert('BS Block 20') do
end
end
a
=
b
=
nil
a
=
b
=
nil
iter
{
|
a
,
b
,
c
,
d
|
assert_equal
([
10
,
20
,
30
,
40
,
nil
,
nil
])
do
[
a
,
b
,
c
,
d
]
iter
{
|
a
,
b
,
c
,
d
|
}
+
[
a
,
b
]
==
[
10
,
20
,
30
,
40
,
nil
,
nil
]
[
a
,
b
,
c
,
d
]
}
+
[
a
,
b
]
end
end
end
assert
(
'BS Block 21'
)
do
assert
(
'BS Block 21'
)
do
...
@@ -227,9 +257,11 @@ assert('BS Block 21') do
...
@@ -227,9 +257,11 @@ assert('BS Block 21') do
yield
1
,
2
yield
1
,
2
end
end
iter
{
|
a
,
*
b
|
assert_equal
([
1
,
[
2
]])
do
[
a
,
b
]
iter
{
|
a
,
*
b
|
}
==
[
1
,
[
2
]]
[
a
,
b
]
}
end
end
end
assert
(
'BS Block 22'
)
do
assert
(
'BS Block 22'
)
do
...
@@ -237,9 +269,11 @@ assert('BS Block 22') do
...
@@ -237,9 +269,11 @@ assert('BS Block 22') do
yield
1
,
2
yield
1
,
2
end
end
iter
{
|*
a
|
assert_equal
([[
1
,
2
]])
do
[
a
]
iter
{
|*
a
|
}
==
[[
1
,
2
]]
[
a
]
}
end
end
end
assert
(
'BS Block 23'
)
do
assert
(
'BS Block 23'
)
do
...
@@ -247,40 +281,48 @@ assert('BS Block 23') do
...
@@ -247,40 +281,48 @@ assert('BS Block 23') do
yield
1
,
2
yield
1
,
2
end
end
iter
{
|
a
,
b
,
*
c
|
assert_equal
([
1
,
2
,
[]])
do
[
a
,
b
,
c
]
iter
{
|
a
,
b
,
*
c
|
}
==
[
1
,
2
,
[]]
[
a
,
b
,
c
]
}
end
end
end
assert
(
'BS Block 24'
)
do
assert
(
'BS Block 24'
)
do
def
m
def
m
yield
yield
end
end
m
{
assert_equal
(
1
)
do
1
m
{
}
==
1
1
}
end
end
end
assert
(
'BS Block 25'
)
do
assert
(
'BS Block 25'
)
do
def
m
def
m
yield
123
yield
123
end
end
m
{
|
ib
|
assert_equal
(
15129
)
do
m
{
|
jb
|
m
{
|
ib
|
ib
*
jb
m
{
|
jb
|
ib
*
jb
}
}
}
}
==
15129
end
end
end
assert
(
'BS Block 26'
)
do
assert
(
'BS Block 26'
)
do
def
m
a
def
m
a
yield
a
yield
a
end
end
m
(
1
){
|
ib
|
assert_equal
(
2
)
do
m
(
2
){
|
jb
|
m
(
1
){
|
ib
|
ib
*
jb
m
(
2
){
|
jb
|
ib
*
jb
}
}
}
}
==
2
end
end
end
assert
(
'BS Block 27'
)
do
assert
(
'BS Block 27'
)
do
...
@@ -289,13 +331,15 @@ assert('BS Block 27') do
...
@@ -289,13 +331,15 @@ assert('BS Block 27') do
2
.
times
{
|
jb
|
2
.
times
{
|
jb
|
sum
+=
ib
+
jb
sum
+=
ib
+
jb
}}
}}
sum
==
9
assert_equal
sum
,
9
end
end
assert
(
'BS Block 28'
)
do
assert
(
'BS Block 28'
)
do
3
.
times
{
|
bl
|
assert_equal
(
10
)
do
break
10
3
.
times
{
|
bl
|
}
==
10
break
10
}
end
end
end
assert
(
'BS Block 29'
)
do
assert
(
'BS Block 29'
)
do
...
@@ -303,9 +347,11 @@ assert('BS Block 29') do
...
@@ -303,9 +347,11 @@ assert('BS Block 29') do
yield
1
,
2
,
3
yield
1
,
2
,
3
end
end
iter
{
|
i
,
j
|
assert_equal
([
1
,
2
])
do
[
i
,
j
]
iter
{
|
i
,
j
|
}
==
[
1
,
2
]
[
i
,
j
]
}
end
end
end
assert
(
'BS Block 30'
)
do
assert
(
'BS Block 30'
)
do
...
@@ -313,23 +359,25 @@ assert('BS Block 30') do
...
@@ -313,23 +359,25 @@ assert('BS Block 30') do
yield
1
yield
1
end
end
iter
{
|
i
,
j
|
assert_equal
([
1
,
nil
])
do
[
i
,
j
]
iter
{
|
i
,
j
|
}
==
[
1
,
nil
]
[
i
,
j
]
}
end
end
end
assert
(
'BS Block [ruby-dev:31147]'
)
do
assert
(
'BS Block [ruby-dev:31147]'
)
do
def
m
def
m
yield
yield
end
end
m
{
|&
b
|
b
}
==
nil
assert_nil
m
{
|&
b
|
b
}
end
end
assert
(
'BS Block [ruby-dev:31160]'
)
do
assert
(
'BS Block [ruby-dev:31160]'
)
do
def
m
()
def
m
()
yield
yield
end
end
m
{
|
(
v
,(
*
))
|
}
==
nil
assert_nil
m
{
|
(
v
,(
*
))
|
}
end
end
assert
(
'BS Block [issue #750]'
)
do
assert
(
'BS Block [issue #750]'
)
do
...
@@ -337,25 +385,26 @@ assert('BS Block [issue #750]') do
...
@@ -337,25 +385,26 @@ assert('BS Block [issue #750]') do
yield
yield
end
end
args
=
[
1
,
2
,
3
]
args
=
[
1
,
2
,
3
]
m
(
*
args
){
1
}
==
1
assert_equal
m
(
*
args
){
1
},
1
end
end
assert
(
'BS Block 31'
)
do
assert
(
'BS Block 31'
)
do
def
m
()
def
m
()
yield
yield
end
end
m
{
|
((
*
))
|
}
==
nil
assert_nil
m
{
|
((
*
))
|
}
end
end
assert
(
'BS Block [ruby-dev:31440]'
)
do
assert
(
'BS Block [ruby-dev:31440]'
)
do
def
m
def
m
yield
[
0
]
yield
[
0
]
end
end
m
{
|
v
,
&
b
|
v
}
==
[
0
]
assert_equal
m
{
|
v
,
&
b
|
v
},
[
0
]
end
end
assert
(
'BS Block 32'
)
do
assert
(
'BS Block 32'
)
do
r
=
false
;
1
.
times
{
|&
b
|
r
=
b
};
r
.
class
==
NilClass
r
=
false
;
1
.
times
{
|&
b
|
r
=
b
}
assert_equal
r
.
class
,
NilClass
end
end
assert
(
'BS Block [ruby-core:14395]'
)
do
assert
(
'BS Block [ruby-core:14395]'
)
do
...
@@ -394,7 +443,7 @@ assert('BS Block [ruby-core:14395]') do
...
@@ -394,7 +443,7 @@ assert('BS Block [ruby-core:14395]') do
end
end
end
end
t
=
Controller
.
new
t
=
Controller
.
new
t
.
test_for_bug
assert_true
t
.
test_for_bug
end
end
assert
(
"BS Block 33"
)
do
assert
(
"BS Block 33"
)
do
...
@@ -408,7 +457,7 @@ assert("BS Block 33") do
...
@@ -408,7 +457,7 @@ assert("BS Block 33") do
:bad
:bad
end
end
end
end
TestReturnFromNestedBlock
.
test
==
:ok
assert_equal
TestReturnFromNestedBlock
.
test
,
:ok
end
end
assert
(
"BS Block 34"
)
do
assert
(
"BS Block 34"
)
do
...
@@ -422,7 +471,7 @@ assert("BS Block 34") do
...
@@ -422,7 +471,7 @@ assert("BS Block 34") do
:bad
:bad
end
end
end
end
TestReturnFromNestedBlock_BSBlock34
.
test
==
:ok
assert_equal
TestReturnFromNestedBlock_BSBlock34
.
test
,
:ok
end
end
assert
(
"BS Block 35"
)
do
assert
(
"BS Block 35"
)
do
...
@@ -436,5 +485,5 @@ assert("BS Block 35") do
...
@@ -436,5 +485,5 @@ assert("BS Block 35") do
:bad
:bad
end
end
end
end
TestReturnFromNestedBlock_BSBlock35
.
test
==
:ok
assert_equal
TestReturnFromNestedBlock_BSBlock35
.
test
,
:ok
end
end
test/t/bs_literal.rb
View file @
d60362b3
...
@@ -2,37 +2,37 @@
...
@@ -2,37 +2,37 @@
# Bootstrap test for literals
# Bootstrap test for literals
assert
(
'BS Literal 1'
)
do
assert
(
'BS Literal 1'
)
do
true
==
true
assert_true
true
end
end
assert
(
'BS Literal 2'
)
do
assert
(
'BS Literal 2'
)
do
TrueClass
==
true
.
class
assert_equal
TrueClass
,
true
.
class
end
end
assert
(
'BS Literal 3'
)
do
assert
(
'BS Literal 3'
)
do
false
==
false
assert_false
false
end
end
assert
(
'BS Literal 4'
)
do
assert
(
'BS Literal 4'
)
do
FalseClass
==
false
.
class
assert_equal
FalseClass
,
false
.
class
end
end
assert
(
'BS Literal 5'
)
do
assert
(
'BS Literal 5'
)
do
'nil'
==
nil
.
inspect
assert_equal
'nil'
,
nil
.
inspect
end
end
assert
(
'BS Literal 6'
)
do
assert
(
'BS Literal 6'
)
do
NilClass
==
nil
.
class
assert_equal
NilClass
,
nil
.
class
end
end
assert
(
'BS Literal 7'
)
do
assert
(
'BS Literal 7'
)
do
Symbol
==
:sym
.
class
assert_equal
Symbol
,
:sym
.
class
end
end
assert
(
'BS Literal 8'
)
do
assert
(
'BS Literal 8'
)
do
1234
==
1234
assert_equal
1234
,
1234
end
end
assert
(
'BS Literal 9'
)
do
assert
(
'BS Literal 9'
)
do
Fixnum
==
1234
.
class
assert_equal
Fixnum
,
1234
.
class
end
end
test/t/float.rb
View file @
d60362b3
...
@@ -2,51 +2,51 @@
...
@@ -2,51 +2,51 @@
# Float ISO Test
# Float ISO Test
assert
(
'Float'
,
'15.2.9'
)
do
assert
(
'Float'
,
'15.2.9'
)
do
Float
.
class
==
Class
assert_equal
Float
.
class
,
Class
end
end
assert
(
'Float superclass'
,
'15.2.9.2'
)
do
assert
(
'Float superclass'
,
'15.2.9.2'
)
do
Float
.
superclass
==
Numeric
assert_equal
Float
.
superclass
,
Numeric
end
end
assert
(
'Float#+'
,
'15.2.9.3.1'
)
do
assert
(
'Float#+'
,
'15.2.9.3.1'
)
do
a
=
3.123456788
+
0.000000001
a
=
3.123456788
+
0.000000001
b
=
3.123456789
+
1
b
=
3.123456789
+
1
check_float
(
a
,
3.123456789
)
and
assert_float
(
a
,
3.123456789
)
check
_float
(
b
,
4.123456789
)
assert
_float
(
b
,
4.123456789
)
end
end
assert
(
'Float#-'
,
'15.2.9.3.2'
)
do
assert
(
'Float#-'
,
'15.2.9.3.2'
)
do
a
=
3.123456790
-
0.000000001
a
=
3.123456790
-
0.000000001
b
=
5.123456789
-
1
b
=
5.123456789
-
1
check_float
(
a
,
3.123456789
)
and
assert_float
(
a
,
3.123456789
)
check
_float
(
b
,
4.123456789
)
assert
_float
(
b
,
4.123456789
)
end
end
assert
(
'Float#*'
,
'15.2.9.3.3'
)
do
assert
(
'Float#*'
,
'15.2.9.3.3'
)
do
a
=
3.125
*
3.125
a
=
3.125
*
3.125
b
=
3.125
*
1
b
=
3.125
*
1
check_float
(
a
,
9.765625
)
and
assert_float
(
a
,
9.765625
)
check
_float
(
b
,
3.125
)
assert
_float
(
b
,
3.125
)
end
end
assert
(
'Float#/'
,
'15.2.9.3.4'
)
do
assert
(
'Float#/'
,
'15.2.9.3.4'
)
do
a
=
3.123456789
/
3.123456789
a
=
3.123456789
/
3.123456789
b
=
3.123456789
/
1
b
=
3.123456789
/
1
check_float
(
a
,
1.0
)
and
assert_float
(
a
,
1.0
)
check
_float
(
b
,
3.123456789
)
assert
_float
(
b
,
3.123456789
)
end
end
assert
(
'Float#%'
,
'15.2.9.3.5'
)
do
assert
(
'Float#%'
,
'15.2.9.3.5'
)
do
a
=
3.125
%
3.125
a
=
3.125
%
3.125
b
=
3.125
%
1
b
=
3.125
%
1
check_float
(
a
,
0.0
)
and
assert_float
(
a
,
0.0
)
check
_float
(
b
,
0.125
)
assert
_float
(
b
,
0.125
)
end
end
assert
(
'Float#<=>'
,
'15.2.9.3.6'
)
do
assert
(
'Float#<=>'
,
'15.2.9.3.6'
)
do
...
@@ -56,12 +56,16 @@ assert('Float#<=>', '15.2.9.3.6') do
...
@@ -56,12 +56,16 @@ assert('Float#<=>', '15.2.9.3.6') do
a2
=
3.125
<=>
3
a2
=
3.125
<=>
3
c2
=
3.125
<=>
4
c2
=
3.125
<=>
4
a
==
1
and
b
==
0
and
c
==
-
1
and
assert_equal
a
,
1
a2
==
1
and
c2
==
-
1
assert_equal
b
,
0
assert_equal
c
,
-
1
assert_equal
a2
,
1
assert_equal
c2
,
-
1
end
end
assert
(
'Float#=='
,
'15.2.9.3.7'
)
do
assert
(
'Float#=='
,
'15.2.9.3.7'
)
do
3.1
==
3.1
and
not
3.1
==
3.2
assert_true
3.1
==
3.1
assert_false
3.1
==
3.2
end
end
assert
(
'Float#ceil'
,
'15.2.9.3.8'
)
do
assert
(
'Float#ceil'
,
'15.2.9.3.8'
)
do
...
@@ -69,12 +73,16 @@ assert('Float#ceil', '15.2.9.3.8') do
...
@@ -69,12 +73,16 @@ assert('Float#ceil', '15.2.9.3.8') do
b
=
3.0
.
ceil
b
=
3.0
.
ceil
c
=
-
3.123456789
.
ceil
c
=
-
3.123456789
.
ceil
d
=
-
3.0
.
ceil
d
=
-
3.0
.
ceil
a
==
4
and
b
==
3
and
c
==
-
3
and
d
==
-
3
assert_equal
a
,
4
assert_equal
b
,
3
assert_equal
c
,
-
3
assert_equal
d
,
-
3
end
end
assert
(
'Float#finite?'
,
'15.2.9.3.9'
)
do
assert
(
'Float#finite?'
,
'15.2.9.3.9'
)
do
3.123456789
.
finite?
and
assert_true
3.123456789
.
finite?
not
(
1.0
/
0.0
).
finite?
assert_false
(
1.0
/
0.0
).
finite?
end
end
assert
(
'Float#floor'
,
'15.2.9.3.10'
)
do
assert
(
'Float#floor'
,
'15.2.9.3.10'
)
do
...
@@ -82,7 +90,11 @@ assert('Float#floor', '15.2.9.3.10') do
...
@@ -82,7 +90,11 @@ assert('Float#floor', '15.2.9.3.10') do
b
=
3.0
.
floor
b
=
3.0
.
floor
c
=
-
3.123456789
.
floor
c
=
-
3.123456789
.
floor
d
=
-
3.0
.
floor
d
=
-
3.0
.
floor
a
==
3
and
b
==
3
and
c
==
-
4
and
d
==
-
3
assert_equal
a
,
3
assert_equal
b
,
3
assert_equal
c
,
-
4
assert_equal
d
,
-
3
end
end
assert
(
'Float#infinite?'
,
'15.2.9.3.11'
)
do
assert
(
'Float#infinite?'
,
'15.2.9.3.11'
)
do
...
@@ -90,7 +102,9 @@ assert('Float#infinite?', '15.2.9.3.11') do
...
@@ -90,7 +102,9 @@ assert('Float#infinite?', '15.2.9.3.11') do
b
=
(
1.0
/
0.0
).
infinite?
b
=
(
1.0
/
0.0
).
infinite?
c
=
(
-
1.0
/
0.0
).
infinite?
c
=
(
-
1.0
/
0.0
).
infinite?
a
==
nil
and
b
==
1
and
c
==
-
1
assert_nil
a
assert_equal
b
,
1
assert_equal
c
,
-
1
end
end
assert
(
'Float#round'
,
'15.2.9.3.12'
)
do
assert
(
'Float#round'
,
'15.2.9.3.12'
)
do
...
@@ -104,20 +118,28 @@ assert('Float#round', '15.2.9.3.12') do
...
@@ -104,20 +118,28 @@ assert('Float#round', '15.2.9.3.12') do
h
=
3.423456789
.
round
(
1
)
h
=
3.423456789
.
round
(
1
)
i
=
3.423456789
.
round
(
3
)
i
=
3.423456789
.
round
(
3
)
a
==
3
and
b
==
4
and
c
==
3
and
d
==
-
3
and
e
==
-
4
and
assert_equal
a
,
3
f
==
12350
and
g
==
3
and
check_float
(
h
,
3.4
)
and
check_float
(
i
,
3.423
)
assert_equal
b
,
4
assert_equal
c
,
3
assert_equal
d
,
-
3
assert_equal
e
,
-
4
assert_equal
f
,
12350
assert_equal
g
,
3
assert_float
(
h
,
3.4
)
assert_float
(
i
,
3.423
)
end
end
assert
(
'Float#to_f'
,
'15.2.9.3.13'
)
do
assert
(
'Float#to_f'
,
'15.2.9.3.13'
)
do
a
=
3.123456789
a
=
3.123456789
check
_float
(
a
.
to_f
,
a
)
assert
_float
(
a
.
to_f
,
a
)
end
end
assert
(
'Float#to_i'
,
'15.2.9.3.14'
)
do
assert
(
'Float#to_i'
,
'15.2.9.3.14'
)
do
3.123456789
.
to_i
==
3
assert_equal
3.123456789
.
to_i
,
3
end
end
assert
(
'Float#truncate'
,
'15.2.9.3.15'
)
do
assert
(
'Float#truncate'
,
'15.2.9.3.15'
)
do
3.123456789
.
truncate
==
3
and
-
3.1
.
truncate
==
-
3
assert_equal
3.123456789
.
truncate
,
3
assert_equal
(
-
3.1
.
truncate
,
-
3
)
end
end
test/t/gc.rb
View file @
d60362b3
# Not ISO specified
# Not ISO specified
assert
(
'GC.enable'
)
do
assert
(
'GC.enable'
)
do
GC
.
disable
==
false
assert_equal
GC
.
disable
,
false
GC
.
enable
==
true
assert_equal
GC
.
enable
,
true
GC
.
enable
==
false
assert_equal
GC
.
enable
,
false
end
end
assert
(
'GC.disable'
)
do
assert
(
'GC.disable'
)
do
begin
begin
GC
.
disable
==
false
assert_equal
GC
.
disable
,
false
GC
.
disable
==
true
assert_equal
GC
.
disable
,
true
ensure
ensure
GC
.
enable
GC
.
enable
end
end
...
@@ -18,7 +18,7 @@ end
...
@@ -18,7 +18,7 @@ end
assert
(
'GC.interval_ratio='
)
do
assert
(
'GC.interval_ratio='
)
do
origin
=
GC
.
interval_ratio
origin
=
GC
.
interval_ratio
begin
begin
(
GC
.
interval_ratio
=
150
)
==
150
assert_equal
(
GC
.
interval_ratio
=
150
),
150
ensure
ensure
GC
.
interval_ratio
=
origin
GC
.
interval_ratio
=
origin
end
end
...
@@ -27,7 +27,7 @@ end
...
@@ -27,7 +27,7 @@ end
assert
(
'GC.step_ratio='
)
do
assert
(
'GC.step_ratio='
)
do
origin
=
GC
.
step_ratio
origin
=
GC
.
step_ratio
begin
begin
(
GC
.
step_ratio
=
150
)
==
150
assert_equal
(
GC
.
step_ratio
=
150
),
150
ensure
ensure
GC
.
step_ratio
=
origin
GC
.
step_ratio
=
origin
end
end
...
@@ -36,9 +36,9 @@ end
...
@@ -36,9 +36,9 @@ end
assert
(
'GC.generational_mode='
)
do
assert
(
'GC.generational_mode='
)
do
origin
=
GC
.
generational_mode
origin
=
GC
.
generational_mode
begin
begin
(
GC
.
generational_mode
=
false
)
==
false
assert_equal
(
GC
.
generational_mode
=
false
),
false
(
GC
.
generational_mode
=
true
)
==
true
assert_equal
(
GC
.
generational_mode
=
true
),
true
(
GC
.
generational_mode
=
true
)
==
true
assert_equal
(
GC
.
generational_mode
=
true
),
true
ensure
ensure
GC
.
generational_mode
=
origin
GC
.
generational_mode
=
origin
end
end
...
...
test/t/indexerror.rb
View file @
d60362b3
...
@@ -2,10 +2,9 @@
...
@@ -2,10 +2,9 @@
# IndexError ISO Test
# IndexError ISO Test
assert
(
'IndexError'
,
'15.2.33'
)
do
assert
(
'IndexError'
,
'15.2.33'
)
do
IndexError
.
class
==
Class
assert_equal
IndexError
.
class
,
Class
end
end
assert
(
'IndexError superclass'
,
'15.2.33.2'
)
do
assert
(
'IndexError superclass'
,
'15.2.33.2'
)
do
IndexError
.
superclass
==
StandardError
assert_equal
IndexError
.
superclass
,
StandardError
end
end
test/t/localjumperror.rb
View file @
d60362b3
##
##
# LocalJumpError ISO Test
# LocalJumpError ISO Test
assert
(
'LocalJumoError'
,
'15.2.25'
)
do
assert
(
'LocalJumpError'
,
'15.2.25'
)
do
begin
assert_equal
LocalJumpError
.
class
,
Class
assert_raise
LocalJumpError
do
# this will cause an exception due to the wrong location
# this will cause an exception due to the wrong location
retry
retry
rescue
=>
e1
end
end
LocalJumpError
.
class
==
Class
and
e1
.
class
==
LocalJumpError
end
end
# TODO 15.2.25.2.1 LocalJumpError#exit_value
# TODO 15.2.25.2.1 LocalJumpError#exit_value
...
...
test/t/nameerror.rb
View file @
d60362b3
...
@@ -2,11 +2,11 @@
...
@@ -2,11 +2,11 @@
# NameError ISO Test
# NameError ISO Test
assert
(
'NameError'
,
'15.2.31'
)
do
assert
(
'NameError'
,
'15.2.31'
)
do
NameError
.
class
==
Class
assert_equal
NameError
.
class
,
Class
end
end
assert
(
'NameError superclass'
,
'15.2.31.2'
)
do
assert
(
'NameError superclass'
,
'15.2.31.2'
)
do
NameError
.
superclass
==
StandardError
assert_equal
NameError
.
superclass
,
StandardError
end
end
assert
(
'NameError#name'
,
'15.2.31.2.1'
)
do
assert
(
'NameError#name'
,
'15.2.31.2.1'
)
do
...
@@ -20,13 +20,13 @@ assert('NameError#name', '15.2.31.2.1') do
...
@@ -20,13 +20,13 @@ assert('NameError#name', '15.2.31.2.1') do
$test_dummy_result
=
e
.
name
$test_dummy_result
=
e
.
name
end
end
$test_dummy_result
==
:bar
assert_equal
$test_dummy_result
,
:bar
end
end
assert
(
'NameError#initialize'
,
'15.2.31.2.2'
)
do
assert
(
'NameError#initialize'
,
'15.2.31.2.2'
)
do
e
=
NameError
.
new
(
'a'
,
:foo
)
e
=
NameError
.
new
(
'a'
,
:foo
)
e
.
class
==
NameError
and
assert_equal
e
.
class
,
NameError
e
.
message
==
'a'
and
assert_equal
e
.
message
,
'a'
e
.
name
==
:foo
assert_equal
e
.
name
,
:foo
end
end
test/t/nil.rb
View file @
d60362b3
...
@@ -2,25 +2,29 @@
...
@@ -2,25 +2,29 @@
# NilClass ISO Test
# NilClass ISO Test
assert
(
'NilClass'
,
'15.2.4'
)
do
assert
(
'NilClass'
,
'15.2.4'
)
do
NilClass
.
class
==
Class
assert_equal
NilClass
.
class
,
Class
end
end
assert
(
'NilClass#&'
,
'15.2.4.3.1'
)
do
assert
(
'NilClass#&'
,
'15.2.4.3.1'
)
do
not
nil
.
&
(
true
)
and
not
nil
.
&
(
nil
)
assert_false
nil
.
&
(
true
)
assert_false
nil
.
&
(
nil
)
end
end
assert
(
'NilClass#^'
,
'15.2.4.3.2'
)
do
assert
(
'NilClass#^'
,
'15.2.4.3.2'
)
do
nil
.
^
(
true
)
and
not
nil
.
^
(
false
)
assert_true
nil
.
^
(
true
)
assert_false
nil
.
^
(
false
)
end
end
assert
(
'NilClass#|'
,
'15.2.4.3.3'
)
do
assert
(
'NilClass#|'
,
'15.2.4.3.3'
)
do
nil
.|
(
true
)
and
not
nil
.|
(
false
)
assert_true
nil
.|
(
true
)
assert_false
nil
.|
(
false
)
end
end
assert
(
'NilClass#nil?'
,
'15.2.4.3.4'
)
do
assert
(
'NilClass#nil?'
,
'15.2.4.3.4'
)
do
nil
.
nil?
assert_true
nil
.
nil?
end
end
assert
(
'NilClass#to_s'
,
'15.2.4.3.5'
)
do
assert
(
'NilClass#to_s'
,
'15.2.4.3.5'
)
do
nil
.
to_s
==
''
assert_equal
nil
.
to_s
,
''
end
end
test/t/nomethoderror.rb
View file @
d60362b3
...
@@ -2,17 +2,12 @@
...
@@ -2,17 +2,12 @@
# NoMethodError ISO Test
# NoMethodError ISO Test
assert
(
'NoMethodError'
,
'15.2.32'
)
do
assert
(
'NoMethodError'
,
'15.2.32'
)
do
e2
=
nil
NoMethodError
.
class
==
Class
begin
assert_raise
NoMethodError
do
doesNotExistAsAMethodNameForVerySure
(
""
)
doesNotExistAsAMethodNameForVerySure
(
""
)
rescue
=>
e1
e2
=
e1
end
end
NoMethodError
.
class
==
Class
and
e2
.
class
==
NoMethodError
end
end
assert
(
'NoMethodError superclass'
,
'15.2.32.2'
)
do
assert
(
'NoMethodError superclass'
,
'15.2.32.2'
)
do
NoMethodError
.
superclass
==
NameError
assert_equal
NoMethodError
.
superclass
,
NameError
end
end
test/t/numeric.rb
View file @
d60362b3
...
@@ -2,27 +2,28 @@
...
@@ -2,27 +2,28 @@
# Numeric ISO Test
# Numeric ISO Test
assert
(
'Numeric'
,
'15.2.7'
)
do
assert
(
'Numeric'
,
'15.2.7'
)
do
Numeric
.
class
==
Class
assert_equal
Numeric
.
class
,
Class
end
end
assert
(
'Numeric superclass'
,
'15.2.7.2'
)
do
assert
(
'Numeric superclass'
,
'15.2.7.2'
)
do
Numeric
.
superclass
==
Object
assert_equal
Numeric
.
superclass
,
Object
end
end
assert
(
'Numeric#+@'
,
'15.2.7.4.1'
)
do
assert
(
'Numeric#+@'
,
'15.2.7.4.1'
)
do
+
1
==
+
1
assert_equal
(
+
1
,
+
1
)
end
end
assert
(
'Numeric#-@'
,
'15.2.7.4.2'
)
do
assert
(
'Numeric#-@'
,
'15.2.7.4.2'
)
do
-
1
==
-
1
assert_equal
(
-
1
,
-
1
)
end
end
assert
(
'Numeric#abs'
,
'15.2.7.4.3'
)
do
assert
(
'Numeric#abs'
,
'15.2.7.4.3'
)
do
1
.
abs
==
1
and
-
1
.
abs
==
1.0
assert_equal
(
1
.
abs
,
1
)
assert_equal
(
-
1
.
abs
,
1.0
)
end
end
# Not ISO specified
# Not ISO specified
assert
(
'Numeric#**'
)
do
assert
(
'Numeric#**'
)
do
2.0
**
3
==
8.0
assert_equal
2.0
**
3
,
8.0
end
end
test/t/object.rb
View file @
d60362b3
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
# Object ISO Test
# Object ISO Test
assert
(
'Object'
,
'15.2.1'
)
do
assert
(
'Object'
,
'15.2.1'
)
do
Object
.
class
==
Class
assert_equal
Object
.
class
,
Class
end
end
assert
(
'Object superclass'
,
'15.2.1.2'
)
do
assert
(
'Object superclass'
,
'15.2.1.2'
)
do
Object
.
superclass
==
BasicObject
assert_equal
Object
.
superclass
,
BasicObject
end
end
test/t/proc.rb
View file @
d60362b3
...
@@ -2,25 +2,19 @@
...
@@ -2,25 +2,19 @@
# Proc ISO Test
# Proc ISO Test
assert
(
'Proc'
,
'15.2.17'
)
do
assert
(
'Proc'
,
'15.2.17'
)
do
Proc
.
class
==
Class
assert_equal
Proc
.
class
,
Class
end
end
assert
(
'Proc superclass'
,
'15.2.17.2'
)
do
assert
(
'Proc superclass'
,
'15.2.17.2'
)
do
Proc
.
superclass
==
Object
assert_equal
Proc
.
superclass
,
Object
end
end
assert
(
'Proc.new'
,
'15.2.17.3.1'
)
do
assert
(
'Proc.new'
,
'15.2.17.3.1'
)
do
a
=
nil
assert_raise
ArgumentError
do
begin
Proc
.
new
Proc
.
new
rescue
=>
e
a
=
e
end
end
b
=
Proc
.
new
{}
assert_equal
(
Proc
.
new
{}).
class
,
Proc
a
.
class
==
ArgumentError
and
b
.
class
==
Proc
end
end
assert
(
'Proc#[]'
,
'15.2.17.4.1'
)
do
assert
(
'Proc#[]'
,
'15.2.17.4.1'
)
do
...
@@ -32,7 +26,8 @@ assert('Proc#[]', '15.2.17.4.1') do
...
@@ -32,7 +26,8 @@ assert('Proc#[]', '15.2.17.4.1') do
b2
=
Proc
.
new
{
|
i
|
a2
+=
i
}
b2
=
Proc
.
new
{
|
i
|
a2
+=
i
}
b2
.
[
](
5
)
b2
.
[
](
5
)
a
==
1
and
a2
==
5
assert_equal
a
,
1
assert_equal
a2
,
5
end
end
assert
(
'Proc#arity'
,
'15.2.17.4.2'
)
do
assert
(
'Proc#arity'
,
'15.2.17.4.2'
)
do
...
@@ -41,7 +36,10 @@ assert('Proc#arity', '15.2.17.4.2') do
...
@@ -41,7 +36,10 @@ assert('Proc#arity', '15.2.17.4.2') do
c
=
Proc
.
new
{
|
x
=
0
,
y
|
}.
arity
c
=
Proc
.
new
{
|
x
=
0
,
y
|
}.
arity
d
=
Proc
.
new
{
|
(
x
,
y
),
z
=
0
|
}.
arity
d
=
Proc
.
new
{
|
(
x
,
y
),
z
=
0
|
}.
arity
a
==
2
and
b
==
-
3
and
c
==
1
and
d
==
1
assert_equal
a
,
2
assert_equal
b
,
-
3
assert_equal
c
,
1
assert_equal
d
,
1
end
end
assert
(
'Proc#call'
,
'15.2.17.4.3'
)
do
assert
(
'Proc#call'
,
'15.2.17.4.3'
)
do
...
@@ -53,5 +51,6 @@ assert('Proc#call', '15.2.17.4.3') do
...
@@ -53,5 +51,6 @@ assert('Proc#call', '15.2.17.4.3') do
b2
=
Proc
.
new
{
|
i
|
a2
+=
i
}
b2
=
Proc
.
new
{
|
i
|
a2
+=
i
}
b2
.
call
(
5
)
b2
.
call
(
5
)
a
==
1
and
a2
==
5
assert_equal
a
,
1
assert_equal
a2
,
5
end
end
test/t/rangeerror.rb
View file @
d60362b3
...
@@ -2,10 +2,9 @@
...
@@ -2,10 +2,9 @@
# RangeError ISO Test
# RangeError ISO Test
assert
(
'RangeError'
,
'15.2.26'
)
do
assert
(
'RangeError'
,
'15.2.26'
)
do
RangeError
.
class
==
Class
assert_equal
RangeError
.
class
,
Class
end
end
assert
(
'RangeError superclass'
,
'15.2.26.2'
)
do
assert
(
'RangeError superclass'
,
'15.2.26.2'
)
do
RangeError
.
superclass
==
StandardError
assert_equal
RangeError
.
superclass
,
StandardError
end
end
test/t/runtimeerror.rb
View file @
d60362b3
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
# RuntimeError ISO Test
# RuntimeError ISO Test
assert
(
'RuntimeError'
,
'15.2.28'
)
do
assert
(
'RuntimeError'
,
'15.2.28'
)
do
RuntimeError
.
class
==
Class
assert_equal
RuntimeError
.
class
,
Class
end
end
test/t/standarderror.rb
View file @
d60362b3
...
@@ -2,10 +2,9 @@
...
@@ -2,10 +2,9 @@
# StandardError ISO Test
# StandardError ISO Test
assert
(
'StandardError'
,
'15.2.23'
)
do
assert
(
'StandardError'
,
'15.2.23'
)
do
StandardError
.
class
==
Class
assert_equal
StandardError
.
class
,
Class
end
end
assert
(
'StandardError superclass'
,
'15.2.23.2'
)
do
assert
(
'StandardError superclass'
,
'15.2.23.2'
)
do
StandardError
.
superclass
==
Exception
assert_equal
StandardError
.
superclass
,
Exception
end
end
test/t/symbol.rb
View file @
d60362b3
...
@@ -2,25 +2,26 @@
...
@@ -2,25 +2,26 @@
# Symbol ISO Test
# Symbol ISO Test
assert
(
'Symbol'
,
'15.2.11'
)
do
assert
(
'Symbol'
,
'15.2.11'
)
do
Symbol
.
class
==
Class
assert_equal
Symbol
.
class
,
Class
end
end
assert
(
'Symbol superclass'
,
'15.2.11.2'
)
do
assert
(
'Symbol superclass'
,
'15.2.11.2'
)
do
Symbol
.
superclass
==
Object
assert_equal
Symbol
.
superclass
,
Object
end
end
assert
(
'Symbol#==='
,
'15.2.11.3.1'
)
do
assert
(
'Symbol#==='
,
'15.2.11.3.1'
)
do
:abc
===
:abc
and
not
:abc
===
:cba
assert_true
:abc
==
:abc
assert_false
:abc
==
:cba
end
end
assert
(
'Symbol#id2name'
,
'15.2.11.3.2'
)
do
assert
(
'Symbol#id2name'
,
'15.2.11.3.2'
)
do
:abc
.
id2name
==
'abc'
assert_equal
:abc
.
id2name
,
'abc'
end
end
assert
(
'Symbol#to_s'
,
'15.2.11.3.3'
)
do
assert
(
'Symbol#to_s'
,
'15.2.11.3.3'
)
do
:abc
.
to_s
==
'abc'
assert_equal
:abc
.
to_s
,
'abc'
end
end
assert
(
'Symbol#to_sym'
,
'15.2.11.3.4'
)
do
assert
(
'Symbol#to_sym'
,
'15.2.11.3.4'
)
do
:abc
.
to_sym
==
:abc
assert_equal
:abc
.
to_sym
,
:abc
end
end
test/t/true.rb
View file @
d60362b3
...
@@ -2,29 +2,32 @@
...
@@ -2,29 +2,32 @@
# TrueClass ISO Test
# TrueClass ISO Test
assert
(
'TrueClass'
,
'15.2.5'
)
do
assert
(
'TrueClass'
,
'15.2.5'
)
do
TrueClass
.
class
==
Class
assert_equal
TrueClass
.
class
,
Class
end
end
assert
(
'TrueClass superclass'
,
'15.2.5.2'
)
do
assert
(
'TrueClass superclass'
,
'15.2.5.2'
)
do
TrueClass
.
superclass
==
Object
assert_equal
TrueClass
.
superclass
,
Object
end
end
assert
(
'TrueClass true'
,
'15.2.5.1'
)
do
assert
(
'TrueClass true'
,
'15.2.5.1'
)
do
true
assert_true
true
end
end
assert
(
'TrueClass#&'
,
'15.2.5.3.1'
)
do
assert
(
'TrueClass#&'
,
'15.2.5.3.1'
)
do
true
.
&
(
true
)
and
not
true
.
&
(
false
)
assert_true
true
.
&
(
true
)
assert_false
true
.
&
(
false
)
end
end
assert
(
'TrueClass#^'
,
'15.2.5.3.2'
)
do
assert
(
'TrueClass#^'
,
'15.2.5.3.2'
)
do
not
true
.
^
(
true
)
and
true
.
^
(
false
)
assert_false
true
.
^
(
true
)
assert_true
true
.
^
(
false
)
end
end
assert
(
'TrueClass#to_s'
,
'15.2.5.3.3'
)
do
assert
(
'TrueClass#to_s'
,
'15.2.5.3.3'
)
do
true
.
to_s
==
'true'
assert_equal
true
.
to_s
,
'true'
end
end
assert
(
'TrueClass#|'
,
'15.2.5.3.4'
)
do
assert
(
'TrueClass#|'
,
'15.2.5.3.4'
)
do
true
.|
(
true
)
and
true
.|
(
false
)
assert_true
true
.|
(
true
)
assert_true
true
.|
(
false
)
end
end
test/t/typeerror.rb
View file @
d60362b3
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
# TypeError ISO Test
# TypeError ISO Test
assert
(
'TypeError'
,
'15.2.29'
)
do
assert
(
'TypeError'
,
'15.2.29'
)
do
TypeError
.
class
==
Class
assert_equal
TypeError
.
class
,
Class
end
end
assert
(
'TypeError superclass'
,
'15.2.29.2'
)
do
assert
(
'TypeError superclass'
,
'15.2.29.2'
)
do
TypeError
.
superclass
==
StandardError
assert_equal
TypeError
.
superclass
,
StandardError
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