Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
c717aa6c
Commit
c717aa6c
authored
Aug 10, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix exception-catching test to work on platforms that don't provide a stack trace.
parent
147f6208
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
debug-test.c++
c++/src/kj/debug-test.c++
+15
-4
No files found.
c++/src/kj/debug-test.c++
View file @
c717aa6c
...
...
@@ -264,7 +264,10 @@ TEST(Debug, Catch) {
KJ_IF_MAYBE
(
e
,
exception
)
{
String
what
=
str
(
*
e
);
std
::
string
text
(
what
.
cStr
(),
strchr
(
what
.
cStr
(),
'\n'
)
-
what
.
cStr
());
KJ_IF_MAYBE
(
eol
,
what
.
findFirst
(
'\n'
))
{
what
=
kj
::
str
(
what
.
slice
(
0
,
*
eol
));
}
std
::
string
text
(
what
.
cStr
());
EXPECT_EQ
(
fileLine
(
__FILE__
,
line
)
+
": bug in code: foo"
,
text
);
}
else
{
ADD_FAILURE
()
<<
"Expected exception."
;
...
...
@@ -280,7 +283,10 @@ TEST(Debug, Catch) {
KJ_IF_MAYBE
(
e
,
exception
)
{
String
what
=
str
(
*
e
);
std
::
string
text
(
what
.
cStr
(),
strchr
(
what
.
cStr
(),
'\n'
)
-
what
.
cStr
());
KJ_IF_MAYBE
(
eol
,
what
.
findFirst
(
'\n'
))
{
what
=
kj
::
str
(
what
.
slice
(
0
,
*
eol
));
}
std
::
string
text
(
what
.
cStr
());
EXPECT_EQ
(
fileLine
(
__FILE__
,
line
)
+
": bug in code: foo"
,
text
);
}
else
{
ADD_FAILURE
()
<<
"Expected exception."
;
...
...
@@ -293,8 +299,13 @@ TEST(Debug, Catch) {
line
=
__LINE__
;
KJ_FAIL_ASSERT
(
"foo"
);
ADD_FAILURE
()
<<
"Expected exception."
;
}
catch
(
const
std
::
exception
&
e
)
{
const
char
*
what
=
e
.
what
();
std
::
string
text
(
what
,
strchr
(
what
,
'\n'
)
-
what
);
kj
::
StringPtr
what
=
e
.
what
();
std
::
string
text
=
e
.
what
();
KJ_IF_MAYBE
(
eol
,
what
.
findFirst
(
'\n'
))
{
text
.
assign
(
what
.
cStr
(),
*
eol
);
}
else
{
text
.
assign
(
what
.
cStr
());
}
EXPECT_EQ
(
fileLine
(
__FILE__
,
line
)
+
": bug in code: foo"
,
text
);
}
}
...
...
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