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
e3b339be
Commit
e3b339be
authored
Mar 12, 2019
by
KOBAYASHI Shuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing assertions in `mruby-string-ext` test
parent
46e45245
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
31 deletions
+41
-31
mrbgems/mruby-string-ext/test/string.rb
mrbgems/mruby-string-ext/test/string.rb
+41
-31
No files found.
mrbgems/mruby-string-ext/test/string.rb
View file @
e3b339be
...
...
@@ -33,62 +33,72 @@ assert('String#byteslice') do
end
assert
(
'String#dump'
)
do
(
"
\1
"
*
100
).
dump
# should not raise an exception - regress #1210
"
\0
"
.
inspect
==
"
\"\\
000
\"
"
and
"foo"
.
dump
==
"
\"
foo
\"
"
assert_equal
(
"
\"\\
x00
\"
"
,
"
\0
"
.
dump
)
assert_equal
(
"
\"
foo
\"
"
,
"foo"
.
dump
)
assert_nothing_raised
{
(
"
\1
"
*
100
).
dump
}
# regress #1210
end
assert
(
'String#strip'
)
do
s
=
" abc "
""
.
strip
==
""
and
"
\t\r\n\f\v
"
.
strip
==
""
and
"
\0
a
\0
"
.
strip
==
"
\0
a"
and
"abc"
.
strip
==
"abc"
and
" abc"
.
strip
==
"abc"
and
"abc "
.
strip
==
"abc"
and
" abc "
.
strip
==
"abc"
and
s
==
" abc "
assert_equal
(
"abc"
,
s
.
strip
)
assert_equal
(
" abc "
,
s
)
assert_equal
(
""
,
""
.
strip
)
assert_equal
(
""
,
"
\t\r\n\f\v
"
.
strip
)
assert_equal
(
"
\0
a"
,
"
\0
a
\0
"
.
strip
)
assert_equal
(
"abc"
,
"abc"
.
strip
)
assert_equal
(
"abc"
,
" abc"
.
strip
)
assert_equal
(
"abc"
,
"abc "
.
strip
)
end
assert
(
'String#lstrip'
)
do
s
=
" abc "
s
.
lstrip
""
.
lstrip
==
""
and
"
\t\r\n\f\v
"
.
lstrip
==
""
and
"
\0
a
\0
"
.
lstrip
==
"
\0
a
\0
"
and
"abc"
.
lstrip
==
"abc"
and
" abc"
.
lstrip
==
"abc"
and
"abc "
.
lstrip
==
"abc "
and
" abc "
.
lstrip
==
"abc "
and
s
==
" abc "
assert_equal
(
"abc "
,
s
.
lstrip
)
assert_equal
(
" abc "
,
s
)
assert_equal
(
""
,
""
.
lstrip
)
assert_equal
(
""
,
"
\t\r\n\f\v
"
.
lstrip
)
assert_equal
(
"
\0
a
\0
"
,
"
\0
a
\0
"
.
lstrip
)
assert_equal
(
"abc"
,
"abc"
.
lstrip
)
assert_equal
(
"abc"
,
" abc"
.
lstrip
)
assert_equal
(
"abc "
,
"abc "
.
lstrip
)
end
assert
(
'String#rstrip'
)
do
s
=
" abc "
s
.
rstrip
""
.
rstrip
==
""
and
"
\t\r\n\f\v
"
.
rstrip
==
""
and
"
\0
a
\0
"
.
rstrip
==
"
\0
a"
and
"abc"
.
rstrip
==
"abc"
and
" abc"
.
rstrip
==
" abc"
and
"abc "
.
rstrip
==
"abc"
and
" abc "
.
rstrip
==
" abc"
and
s
==
" abc "
assert_equal
(
" abc"
,
s
.
rstrip
)
assert_equal
(
" abc "
,
s
)
assert_equal
(
""
,
""
.
rstrip
)
assert_equal
(
""
,
"
\t\r\n\f\v
"
.
rstrip
)
assert_equal
(
"
\0
a"
,
"
\0
a
\0
"
.
rstrip
)
assert_equal
(
"abc"
,
"abc"
.
rstrip
)
assert_equal
(
" abc"
,
" abc"
.
rstrip
)
assert_equal
(
"abc"
,
"abc "
.
rstrip
)
end
assert
(
'String#strip!'
)
do
s
=
" abc "
t
=
"abc"
s
.
strip!
==
"abc"
and
s
==
"abc"
and
t
.
strip!
==
nil
assert_equal
(
"abc"
,
s
.
strip!
)
assert_equal
(
"abc"
,
s
)
assert_nil
(
t
.
strip!
)
assert_equal
(
"abc"
,
t
)
end
assert
(
'String#lstrip!'
)
do
s
=
" abc "
t
=
"abc "
s
.
lstrip!
==
"abc "
and
s
==
"abc "
and
t
.
lstrip!
==
nil
assert_equal
(
"abc "
,
s
.
lstrip!
)
assert_equal
(
"abc "
,
s
)
assert_nil
(
t
.
lstrip!
)
assert_equal
(
"abc "
,
t
)
end
assert
(
'String#rstrip!'
)
do
s
=
" abc "
t
=
" abc"
s
.
rstrip!
==
" abc"
and
s
==
" abc"
and
t
.
rstrip!
==
nil
assert_equal
(
" abc"
,
s
.
rstrip!
)
assert_equal
(
" abc"
,
s
)
assert_nil
(
t
.
rstrip!
)
assert_equal
(
" abc"
,
t
)
end
assert
(
'String#swapcase'
)
do
...
...
@@ -127,7 +137,7 @@ assert('String#count') do
assert_equal
4
,
s
.
count
(
"a0-9"
)
end
assert
(
'String#tr'
)
do
assert
(
'String#tr'
)
do
assert_equal
"ABC"
,
"abc"
.
tr
(
'a-z'
,
'A-Z'
)
assert_equal
"hippo"
,
"hello"
.
tr
(
'el'
,
'ip'
)
assert_equal
"Ruby"
,
"Lisp"
.
tr
(
"Lisp"
,
"Ruby"
)
...
...
@@ -141,7 +151,7 @@ assert('String#tr!') do
assert_equal
"ab12222hijklmnopqR"
,
s
end
assert
(
'String#tr_s'
)
do
assert
(
'String#tr_s'
)
do
assert_equal
"hero"
,
"hello"
.
tr_s
(
'l'
,
'r'
)
assert_equal
"h*o"
,
"hello"
.
tr_s
(
'el'
,
'*'
)
assert_equal
"hhxo"
,
"hello"
.
tr_s
(
'el'
,
'hx'
)
...
...
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