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
e60f5f5c
Commit
e60f5f5c
authored
Feb 09, 2019
by
KOBAYASHI Shuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always through `assert_true` for assertion methods in `test/assert.rb`
parent
fc883de4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
25 deletions
+13
-25
test/assert.rb
test/assert.rb
+13
-25
No files found.
test/assert.rb
View file @
e60f5f5c
...
...
@@ -88,15 +88,11 @@ def assert_true(ret, msg = nil, diff = nil)
end
def
assert_false
(
ret
,
msg
=
nil
,
diff
=
nil
)
if
$mrbtest_assert
$mrbtest_assert_idx
+=
1
if
ret
msg
=
"Expected
#{
ret
.
inspect
}
to be false"
unless
msg
diff
=
assertion_diff
(
false
,
ret
)
unless
diff
$mrbtest_assert
.
push
([
$mrbtest_assert_idx
,
msg
,
diff
])
end
if
ret
msg
||=
"Expected
#{
ret
.
inspect
}
to be false"
diff
||=
assertion_diff
(
false
,
ret
)
end
assert_true
(
!
ret
,
msg
,
diff
)
!
ret
end
...
...
@@ -171,41 +167,33 @@ def assert_not_include(collection, obj, msg = nil)
end
def
assert_raise
(
*
exc
)
return
true
unless
$mrbtest_assert
$mrbtest_assert_idx
+=
1
msg
=
(
exc
.
last
.
is_a?
String
)
?
exc
.
pop
:
nil
begin
yield
msg
||=
"Expected to raise
#{
exc
}
but nothing was raised."
diff
=
nil
$mrbtest_assert
.
push
[
$mrbtest_assert_idx
,
msg
,
diff
]
false
rescue
*
exc
true
assert_true
(
true
)
rescue
Exception
=>
e
msg
||=
"Expected to raise
#{
exc
}
, not"
diff
=
" Class: <
#{
e
.
class
}
>
\n
"
+
" Message:
#{
e
.
message
}
"
$mrbtest_assert
.
push
[
$mrbtest_assert_idx
,
msg
,
diff
]
false
assert_true
(
false
,
msg
,
diff
)
else
msg
||=
"Expected to raise
#{
exc
}
but nothing was raised."
diff
=
""
assert_true
(
false
,
msg
,
diff
)
end
end
def
assert_nothing_raised
(
msg
=
nil
)
return
true
unless
$mrbtest_assert
$mrbtest_assert_idx
+=
1
begin
yield
true
rescue
Exception
=>
e
msg
||=
"Expected not to raise
#{
e
}
but it raised"
diff
=
" Class: <
#{
e
.
class
}
>
\n
"
+
" Message:
#{
e
.
message
}
"
$mrbtest_assert
.
push
[
$mrbtest_assert_idx
,
msg
,
diff
]
false
assert_true
(
false
,
msg
,
diff
)
else
assert_true
(
true
)
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