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
b7651d21
Commit
b7651d21
authored
Aug 02, 2013
by
Jun Hiroe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I fix order of actual and expect test value in literals.rb.
parent
b423171e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
82 deletions
+82
-82
test/t/literals.rb
test/t/literals.rb
+82
-82
No files found.
test/t/literals.rb
View file @
b7651d21
...
...
@@ -10,29 +10,29 @@ assert('Literals Numerical', '8.7.6.2') do
assert_equal
1.0
,
1.0
assert_equal
(
-
1.0
,
-
1.0
)
# binary
assert_equal
0b10000000
,
128
assert_equal
0
B10000000
,
128
assert_equal
128
,
0b10000000
assert_equal
128
,
0
B10000000
# octal
assert_equal
0
o10
,
8
assert_equal
0
O10
,
8
assert_equal
0_10
,
8
assert_equal
8
,
0
o10
assert_equal
8
,
0
O10
assert_equal
8
,
0_10
# hex
assert_equal
0xff
,
255
assert_equal
0
Xff
,
255
assert_equal
255
,
0xff
assert_equal
255
,
0
Xff
# decimal
assert_equal
0
d999
,
999
assert_equal
0
D999
,
999
assert_equal
999
,
0
d
999
assert_equal
999
,
0
D
999
# decimal seperator
assert_equal
10
_000_000
,
10000
000
assert_equal
1_0
,
1
0
assert_equal
10
000000
,
10_000_
000
assert_equal
10
,
1_
0
# integer with exponent
assert_equal
1
e1
,
10.0
assert_equal
1e-1
,
0.1
assert_equal
1
e+1
,
10.0
assert_equal
1
0.0
,
1e1
,
assert_equal
(
0.1
,
1e-1
)
assert_equal
1
0.0
,
1e+1
# float with exponent
assert_equal
1
.0e1
,
10.0
assert_equal
1.0e-1
,
0.1
assert_equal
1
.0e+1
,
10.0
assert_equal
1
0.0
,
1.0e1
assert_equal
(
0.1
,
1.0e-1
)
assert_equal
1
0.0
,
1.0e+1
end
assert
(
'Literals Strings Single Quoted'
,
'8.7.6.3.2'
)
do
...
...
@@ -47,7 +47,7 @@ assert('Literals Strings Double Quoted', '8.7.6.3.3') do
assert_equal
"abc"
,
"abc"
assert_equal
"
\"
"
,
"
\"
"
assert_equal
"
\\
"
,
"
\\
"
assert_equal
"
#{
a
}
"
,
"abc
"
assert_equal
"
abc"
,
"
#{
a
}
"
end
assert
(
'Literals Strings Quoted Non-Expanded'
,
'8.7.6.3.4'
)
do
...
...
@@ -59,13 +59,13 @@ assert('Literals Strings Quoted Non-Expanded', '8.7.6.3.4') do
f
=
%q/ab
\/
c/
g
=
%q{#{a}}
assert_equal
a
,
'abc'
assert_equal
b
,
'abc'
assert_equal
c
,
'abc'
assert_equal
d
,
'abc'
assert_equal
e
,
'abc'
assert_equal
f
,
'ab/c'
assert_equal
g
,
'#{a}'
assert_equal
'abc'
,
a
assert_equal
'abc'
,
b
assert_equal
'abc'
,
c
assert_equal
'abc'
,
d
assert_equal
'abc'
,
e
assert_equal
'ab/c'
,
f
assert_equal
'#{a}'
,
g
end
assert
(
'Literals Strings Quoted Expanded'
,
'8.7.6.3.5'
)
do
...
...
@@ -77,13 +77,13 @@ assert('Literals Strings Quoted Expanded', '8.7.6.3.5') do
f
=
%Q/ab
\/
c/
g
=
%Q{
#{
a
}
}
assert_equal
a
,
'abc'
assert_equal
b
,
'abc'
assert_equal
c
,
'abc'
assert_equal
d
,
'abc'
assert_equal
e
,
'abc'
assert_equal
f
,
'ab/c'
assert_equal
g
,
'abc'
assert_equal
'abc'
,
a
assert_equal
'abc'
,
b
assert_equal
'abc'
,
c
assert_equal
'abc'
,
d
assert_equal
'abc'
,
e
assert_equal
'ab/c'
,
f
assert_equal
'abc'
,
g
end
assert
(
'Literals Strings Here documents'
,
'8.7.6.3.6'
)
do
...
...
@@ -141,18 +141,18 @@ KKK
z
=
<<
'ZZZ'
ZZZ
assert_equal
a
,
"aaa
\n
"
assert_equal
b
,
"bbb
\n
"
assert_equal
c
,
[
"c1
\n
"
,
"c 2
\n
"
,
"c 3
\n
"
]
assert_equal
d
,
"d3DDD
\n
d
\t\n
DDD
\n\n
"
assert_equal
e
,
"e
\#
{1+2}EEE
\n
e
\\
t
\n
EEE
\\
n
\n
"
assert_equal
f
,
"F
\n
FFfFFF
\n
F
\n
"
assert_equal
g
,
" ggg
\n
"
assert_equal
h
,
" hhh
\n
"
assert_equal
i
,
" iii
\n
"
assert_equal
j
,
[
" j1j
\n
"
,
" j2j
\n
"
,
" j
\#
{3}j
\n
"
]
assert_equal
k
,
123
assert_equal
z
,
""
assert_equal
"aaa
\n
"
,
a
assert_equal
"bbb
\n
"
,
b
assert_equal
[
"c1
\n
"
,
"c 2
\n
"
,
"c 3
\n
"
],
c
assert_equal
"d3DDD
\n
d
\t\n
DDD
\n\n
"
,
d
assert_equal
"e
\#
{1+2}EEE
\n
e
\\
t
\n
EEE
\\
n
\n
"
,
e
assert_equal
"F
\n
FFfFFF
\n
F
\n
"
,
f
assert_equal
" ggg
\n
"
,
g
assert_equal
" hhh
\n
"
,
h
assert_equal
" iii
\n
"
,
i
assert_equal
[
" j1j
\n
"
,
" j2j
\n
"
,
" j
\#
{3}j
\n
"
],
j
assert_equal
123
,
k
assert_equal
""
,
z
end
assert
(
'Literals Array'
,
'8.7.6.4'
)
do
...
...
@@ -173,14 +173,14 @@ assert('Literals Array', '8.7.6.4') do
d
x
\y
x
\\
y x
\\\y
)
assert_equal
a
,
[
'abc3def'
,
'}g'
]
assert_equal
b
,
[
'abc'
,
'5'
,
'def'
,
'(g'
]
assert_equal
c
,
[
'7'
]
assert_equal
d
,
[
'9'
]
assert_equal
e
,
[]
assert_equal
f
,
[
'[ab'
,
'cd][ef]'
]
assert_equal
g
,
[
'ab'
,
'-11'
,
'22'
]
assert_equal
h
,
[
"a
\n
b"
,
'test abc'
,
"c
\n
d"
,
"xy"
,
"x
\\
y"
,
"x
\\
y"
]
assert_equal
[
'abc3def'
,
'}g'
],
a
assert_equal
[
'abc'
,
'5'
,
'def'
,
'(g'
],
b
assert_equal
[
'7'
],
c
assert_equal
[
'9'
],
d
assert_equal
[],
e
assert_equal
[
'[ab'
,
'cd][ef]'
],
f
assert_equal
[
'ab'
,
'-11'
,
'22'
],
g
assert_equal
[
"a
\n
b"
,
'test abc'
,
"c
\n
d"
,
"xy"
,
"x
\\
y"
,
"x
\\
y"
],
h
a
=
%w{abc#{1+2}def
\}
g}
b
=
%w(abc #{2+3} def
\(
g)
...
...
@@ -199,14 +199,14 @@ d
d
x\y x
\\
y x
\\
\y)
assert_equal
a
,
[
'abc#{1+2}def'
,
'}g'
]
assert_equal
b
,
[
'abc'
,
'#{2+3}'
,
'def'
,
'(g'
]
assert_equal
c
,
[
'#{3+4}'
]
assert_equal
d
,
[
'#{4+5}'
]
assert_equal
e
,
[]
assert_equal
f
,
[
'[ab'
,
'cd][ef]'
]
assert_equal
g
,
[
'ab'
,
'#{-1}1'
,
'2#{2}'
]
assert_equal
h
,
[
"a
\\
nb"
,
"test abc"
,
"c
\n
d"
,
"x
\\
y"
,
"x
\\
y"
,
"x
\\\\
y"
]
assert_equal
[
'abc#{1+2}def'
,
'}g'
],
a
assert_equal
[
'abc'
,
'#{2+3}'
,
'def'
,
'(g'
],
b
assert_equal
[
'#{3+4}'
],
c
assert_equal
[
'#{4+5}'
],
d
assert_equal
[],
e
assert_equal
[
'[ab'
,
'cd][ef]'
],
f
assert_equal
[
'ab'
,
'#{-1}1'
,
'2#{2}'
],
g
assert_equal
[
"a
\\
nb"
,
"test abc"
,
"c
\n
d"
,
"x
\\
y"
,
"x
\\
y"
,
"x
\\\\
y"
],
h
end
assert
(
'Literals Array of symbols'
)
do
...
...
@@ -222,13 +222,13 @@ assert('Literals Array of symbols') do
2
#{
2
}
}
assert_equal
a
,
[
:'abc3def'
,
:'}g'
]
assert_equal
b
,
[
:'abc'
,
:'5'
,
:'def'
,
:'(g'
]
assert_equal
c
,
[
:'7'
]
assert_equal
d
,
[
:'9'
]
assert_equal
e
,
[]
assert_equal
f
,
[
:'[ab'
,
:'cd][ef]'
]
assert_equal
g
,
[
:'ab'
,
:'-11'
,
:'22'
]
assert_equal
[
:'abc3def'
,
:'}g'
],
a
assert_equal
[
:'abc'
,
:'5'
,
:'def'
,
:'(g'
],
b
assert_equal
[
:'7'
],
c
assert_equal
[
:'9'
],
d
assert_equal
[],
e
assert_equal
[
:'[ab'
,
:'cd][ef]'
],
f
assert_equal
[
:'ab'
,
:'-11'
,
:'22'
],
g
a
=
%i{abc#{1+2}def
\}
g}
b
=
%i(abc #{2+3} def
\(
g)
...
...
@@ -242,13 +242,13 @@ assert('Literals Array of symbols') do
2#{2}
}
assert_equal
a
,
[
:'abc#{1+2}def'
,
:'}g'
]
assert_equal
b
,
[
:'abc'
,
:'#{2+3}'
,
:'def'
,
:'(g'
]
assert_equal
c
,
[
:'#{3+4}'
]
assert_equal
d
,
[
:'#{4+5}'
]
assert_equal
e
,
[]
assert_equal
f
,
[
:'[ab'
,
:'cd][ef]'
]
assert_equal
g
,
[
:'ab'
,
:'#{-1}1'
,
:'2#{2}'
]
assert_equal
[
:'abc#{1+2}def'
,
:'}g'
],
a
assert_equal
[
:'abc'
,
:'#{2+3}'
,
:'def'
,
:'(g'
],
b
assert_equal
[
:'#{3+4}'
],
c
assert_equal
[
:'#{4+5}'
],
d
assert_equal
[]
,
e
assert_equal
[
:'[ab'
,
:'cd][ef]'
],
f
assert_equal
[
:'ab'
,
:'#{-1}1'
,
:'2#{2}'
],
g
end
assert
(
'Literals Symbol'
,
'8.7.6.6'
)
do
...
...
@@ -274,14 +274,14 @@ qwe]
g
=
%s/foo#{1+2}bar/
h
=
%s{{foo bar}}
assert_equal
a
,
:'asd qwe'
assert_equal
b
,
:"foo bar"
assert_equal
c
,
:a3b
assert_equal
d
,
:as
d
assert_equal
e
,
:' foo )'
assert_equal
f
,
:"asd [
\n
qwe"
assert_equal
g
,
:'foo#{1+2}bar'
assert_equal
h
,
:'{foo bar}'
assert_equal
:'asd qwe'
,
a
assert_equal
:"foo bar"
,
b
assert_equal
:a3b
,
c
assert_equal
:asd
,
d
assert_equal
:' foo )'
,
e
assert_equal
:"asd [
\n
qwe"
,
f
assert_equal
:'foo#{1+2}bar'
,
g
assert_equal
:'{foo bar}'
,
h
end
# Not Implemented ATM assert('Literals Regular expression', '8.7.6.5') do
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