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
a215292b
Commit
a215292b
authored
Jun 28, 2019
by
dearblue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use nested `assert`
parent
1b9f949f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
30 deletions
+42
-30
mrbgems/mruby-bin-mruby/bintest/mruby.rb
mrbgems/mruby-bin-mruby/bintest/mruby.rb
+5
-3
mrbgems/mruby-complex/test/complex.rb
mrbgems/mruby-complex/test/complex.rb
+4
-2
mrbgems/mruby-io/test/io.rb
mrbgems/mruby-io/test/io.rb
+17
-15
mrbgems/mruby-pack/test/pack.rb
mrbgems/mruby-pack/test/pack.rb
+4
-2
mrbgems/mruby-rational/test/rational.rb
mrbgems/mruby-rational/test/rational.rb
+12
-8
No files found.
mrbgems/mruby-bin-mruby/bintest/mruby.rb
View file @
a215292b
...
...
@@ -3,9 +3,11 @@ require 'open3'
def
assert_mruby
(
exp_out
,
exp_err
,
exp_success
,
args
)
out
,
err
,
stat
=
Open3
.
capture3
(
cmd
(
"mruby"
),
*
args
)
assert_operator
(
exp_out
,
:===
,
out
,
"standard output"
)
assert_operator
(
exp_err
,
:===
,
err
,
"standard error"
)
assert_equal
(
exp_success
,
stat
.
success?
,
"exit success?"
)
assert
do
assert_operator
(
exp_out
,
:===
,
out
,
"standard output"
)
assert_operator
(
exp_err
,
:===
,
err
,
"standard error"
)
assert_equal
(
exp_success
,
stat
.
success?
,
"exit success?"
)
end
end
assert
(
'regression for #1564'
)
do
...
...
mrbgems/mruby-complex/test/complex.rb
View file @
a215292b
def
assert_complex
(
real
,
exp
)
assert_float
real
.
real
,
exp
.
real
assert_float
real
.
imaginary
,
exp
.
imaginary
assert
do
assert_float
real
.
real
,
exp
.
real
assert_float
real
.
imaginary
,
exp
.
imaginary
end
end
assert
'Complex'
do
...
...
mrbgems/mruby-io/test/io.rb
View file @
a215292b
...
...
@@ -5,24 +5,26 @@ MRubyIOTestUtil.io_test_setup
$cr
,
$crlf
,
$cmd
=
MRubyIOTestUtil
.
win?
?
[
1
,
"
\r\n
"
,
"cmd /c "
]
:
[
0
,
"
\n
"
,
""
]
def
assert_io_open
(
meth
)
fd
=
IO
.
sysopen
(
$mrbtest_io_rfname
)
assert_equal
Fixnum
,
fd
.
class
io1
=
IO
.
__send__
(
meth
,
fd
)
begin
assert_equal
IO
,
io1
.
class
assert_equal
$mrbtest_io_msg
,
io1
.
read
ensure
io1
.
close
end
assert
do
fd
=
IO
.
sysopen
(
$mrbtest_io_rfname
)
assert_equal
Fixnum
,
fd
.
class
io1
=
IO
.
__send__
(
meth
,
fd
)
begin
assert_equal
IO
,
io1
.
class
assert_equal
$mrbtest_io_msg
,
io1
.
read
ensure
io1
.
close
end
io2
=
IO
.
__send__
(
meth
,
IO
.
sysopen
(
$mrbtest_io_rfname
))
do
|
io
|
if
meth
==
:open
assert_equal
$mrbtest_io_msg
,
io
.
read
else
flunk
"IO.
#{
meth
}
does not take block"
io2
=
IO
.
__send__
(
meth
,
IO
.
sysopen
(
$mrbtest_io_rfname
))
do
|
io
|
if
meth
==
:open
assert_equal
$mrbtest_io_msg
,
io
.
read
else
flunk
"IO.
#{
meth
}
does not take block"
end
end
io2
.
close
unless
meth
==
:open
end
io2
.
close
unless
meth
==
:open
end
assert
(
'IO.class'
,
'15.2.20'
)
do
...
...
mrbgems/mruby-pack/test/pack.rb
View file @
a215292b
...
...
@@ -2,8 +2,10 @@ PACK_IS_LITTLE_ENDIAN = "\x01\00".unpack('S')[0] == 0x01
def
assert_pack
tmpl
,
packed
,
unpacked
t
=
tmpl
.
inspect
assert_equal
packed
,
unpacked
.
pack
(
tmpl
),
"
#{
unpacked
.
inspect
}
.pack(
#{
t
}
)"
assert_equal
unpacked
,
packed
.
unpack
(
tmpl
),
"
#{
packed
.
inspect
}
.unpack(
#{
t
}
)"
assert
do
assert_equal
packed
,
unpacked
.
pack
(
tmpl
),
"
#{
unpacked
.
inspect
}
.pack(
#{
t
}
)"
assert_equal
unpacked
,
packed
.
unpack
(
tmpl
),
"
#{
packed
.
inspect
}
.unpack(
#{
t
}
)"
end
end
# pack & unpack 'm' (base64)
...
...
mrbgems/mruby-rational/test/rational.rb
View file @
a215292b
...
...
@@ -23,17 +23,21 @@ class ComplexLikeNumeric < UserDefinedNumeric
end
def
assert_rational
(
exp
,
real
)
assert_float
exp
.
numerator
,
real
.
numerator
assert_float
exp
.
denominator
,
real
.
denominator
assert
do
assert_float
exp
.
numerator
,
real
.
numerator
assert_float
exp
.
denominator
,
real
.
denominator
end
end
def
assert_equal_rational
(
exp
,
o1
,
o2
)
if
exp
assert_operator
(
o1
,
:==
,
o2
)
assert_not_operator
(
o1
,
:
!=
,
o2
)
else
assert_not_operator
(
o1
,
:==
,
o2
)
assert_operator
(
o1
,
:
!=
,
o2
)
assert
do
if
exp
assert_operator
(
o1
,
:==
,
o2
)
assert_not_operator
(
o1
,
:
!=
,
o2
)
else
assert_not_operator
(
o1
,
:==
,
o2
)
assert_operator
(
o1
,
:
!=
,
o2
)
end
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