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
a2472904
Commit
a2472904
authored
Jul 19, 2014
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print backtrace of crashed test in verbose mode.
parent
d17506c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
test/assert.rb
test/assert.rb
+4
-2
No files found.
test/assert.rb
View file @
a2472904
...
@@ -21,7 +21,7 @@ end
...
@@ -21,7 +21,7 @@ end
##
##
# Create the assertion in a readable way
# Create the assertion in a readable way
def
assertion_string
(
err
,
str
,
iso
=
nil
,
e
=
nil
)
def
assertion_string
(
err
,
str
,
iso
=
nil
,
e
=
nil
,
bt
=
nil
)
msg
=
"
#{
err
}#{
str
}
"
msg
=
"
#{
err
}#{
str
}
"
msg
+=
" [
#{
iso
}
]"
if
iso
&&
iso
!=
''
msg
+=
" [
#{
iso
}
]"
if
iso
&&
iso
!=
''
msg
+=
" =>
#{
e
.
message
}
"
if
e
msg
+=
" =>
#{
e
.
message
}
"
if
e
...
@@ -31,6 +31,7 @@ def assertion_string(err, str, iso=nil, e=nil)
...
@@ -31,6 +31,7 @@ def assertion_string(err, str, iso=nil, e=nil)
msg
+=
"
\n
- Assertion[
#{
idx
}
] Failed:
#{
str
}
\n
#{
diff
}
"
msg
+=
"
\n
- Assertion[
#{
idx
}
] Failed:
#{
str
}
\n
#{
diff
}
"
end
end
end
end
msg
+=
"
\n
backtrace:
\n\t
#{
bt
.
join
(
"
\n\t
"
)
}
"
if
bt
msg
msg
end
end
...
@@ -56,11 +57,12 @@ def assert(str = 'Assertion failed', iso = '')
...
@@ -56,11 +57,12 @@ def assert(str = 'Assertion failed', iso = '')
t_print
(
'.'
)
t_print
(
'.'
)
end
end
rescue
Exception
=>
e
rescue
Exception
=>
e
bt
=
e
.
backtrace
if
$mrbtest_verbose
if
e
.
class
.
to_s
==
'MRubyTestSkip'
if
e
.
class
.
to_s
==
'MRubyTestSkip'
$asserts
.
push
"Skip:
#{
str
}
#{
iso
}
#{
e
.
cause
}
"
$asserts
.
push
"Skip:
#{
str
}
#{
iso
}
#{
e
.
cause
}
"
t_print
(
'?'
)
t_print
(
'?'
)
else
else
$asserts
.
push
(
assertion_string
(
"
#{
e
.
class
}
: "
,
str
,
iso
,
e
))
$asserts
.
push
(
assertion_string
(
"
#{
e
.
class
}
: "
,
str
,
iso
,
e
,
bt
))
$kill_test
+=
1
$kill_test
+=
1
t_print
(
'X'
)
t_print
(
'X'
)
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