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
2d67f0b8
Commit
2d67f0b8
authored
Dec 07, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix -fno-exceptions tests.
parent
aa1bdc3e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
30 additions
and
58 deletions
+30
-58
capability-test.c++
c++/src/capnp/capability-test.c++
+2
-9
dynamic-test.c++
c++/src/capnp/dynamic-test.c++
+0
-8
encoding-test.c++
c++/src/capnp/encoding-test.c++
+0
-14
orphan-test.c++
c++/src/capnp/orphan-test.c++
+0
-8
schema-loader-test.c++
c++/src/capnp/schema-loader-test.c++
+0
-8
schema-test.c++
c++/src/capnp/schema-test.c++
+4
-9
test-util.c++
c++/src/capnp/test-util.c++
+1
-0
test-util.h
c++/src/capnp/test-util.h
+14
-0
async-test.c++
c++/src/kj/async-test.c++
+1
-1
exception.c++
c++/src/kj/exception.c++
+2
-1
mutex-test.c++
c++/src/kj/mutex-test.c++
+6
-0
No files found.
c++/src/capnp/capability-test.c++
View file @
2d67f0b8
...
...
@@ -42,14 +42,6 @@ namespace capnp {
namespace
_
{
namespace
{
#if KJ_NO_EXCEPTIONS
#undef EXPECT_ANY_THROW
#define EXPECT_ANY_THROW(code) EXPECT_DEATH(code, ".")
#define EXPECT_NONFATAL_FAILURE(code) code
#else
#define EXPECT_NONFATAL_FAILURE EXPECT_ANY_THROW
#endif
TEST
(
Capability
,
Basic
)
{
kj
::
EventLoop
loop
;
kj
::
WaitScope
waitScope
(
loop
);
...
...
@@ -373,7 +365,8 @@ public:
EXPECT_ANY_THROW
(
context
.
getParams
());
return
kj
::
READY_NOW
;
}
else
{
KJ_FAIL_ASSERT
(
"Method not implemented"
,
methodName
);
KJ_FAIL_ASSERT
(
"Method not implemented"
,
methodName
)
{
break
;
}
return
kj
::
READY_NOW
;
}
}
};
...
...
c++/src/capnp/dynamic-test.c++
View file @
2d67f0b8
...
...
@@ -313,14 +313,6 @@ TEST(DynamicApi, UnionsRead) {
}
}
#if KJ_NO_EXCEPTIONS
#undef EXPECT_ANY_THROW
#define EXPECT_ANY_THROW(code) EXPECT_DEATH(code, ".")
#define EXPECT_NONFATAL_FAILURE(code) code
#else
#define EXPECT_NONFATAL_FAILURE EXPECT_ANY_THROW
#endif
TEST
(
DynamicApi
,
UnionsWrite
)
{
MallocMessageBuilder
builder
;
auto
root
=
builder
.
initRoot
<
DynamicStruct
>
(
Schema
::
from
<
TestUnion
>
());
...
...
c++/src/capnp/encoding-test.c++
View file @
2d67f0b8
...
...
@@ -138,20 +138,6 @@ TEST(Encoding, DefaultsFromEmptyMessage) {
checkTestMessage
(
readMessageUnchecked
<
TestDefaults
>
(
emptyMessage
.
words
));
}
#if KJ_NO_EXCEPTIONS
#undef EXPECT_ANY_THROW
#define EXPECT_ANY_THROW(code) EXPECT_DEATH(code, ".")
#define EXPECT_NONFATAL_FAILURE(code) code
#else
#define EXPECT_NONFATAL_FAILURE EXPECT_ANY_THROW
#endif
#ifdef KJ_DEBUG
#define EXPECT_DEBUG_ANY_THROW EXPECT_ANY_THROW
#else
#define EXPECT_DEBUG_ANY_THROW(EXP)
#endif
TEST
(
Encoding
,
Unions
)
{
MallocMessageBuilder
builder
;
TestUnion
::
Builder
root
=
builder
.
getRoot
<
TestUnion
>
();
...
...
c++/src/capnp/orphan-test.c++
View file @
2d67f0b8
...
...
@@ -138,14 +138,6 @@ TEST(Orphans, Data) {
EXPECT_EQ
(
data
(
"foo"
),
root
.
getDataField
());
}
#if KJ_NO_EXCEPTIONS
#undef EXPECT_ANY_THROW
#define EXPECT_ANY_THROW(code) EXPECT_DEATH(code, ".")
#define EXPECT_NONFATAL_FAILURE(code) code
#else
#define EXPECT_NONFATAL_FAILURE EXPECT_ANY_THROW
#endif
TEST
(
Orphans
,
NoCrossMessageTransfers
)
{
MallocMessageBuilder
builder1
;
MallocMessageBuilder
builder2
;
...
...
c++/src/capnp/schema-loader-test.c++
View file @
2d67f0b8
...
...
@@ -88,14 +88,6 @@ TEST(SchemaLoader, LoadUnnamedUnion) {
EXPECT_TRUE
(
schema
.
findFieldByName
(
"after"
)
!=
nullptr
);
}
#if KJ_NO_EXCEPTIONS
#undef EXPECT_ANY_THROW
#define EXPECT_ANY_THROW(code) EXPECT_DEATH(code, ".")
#define EXPECT_NONFATAL_FAILURE(code) code
#else
#define EXPECT_NONFATAL_FAILURE EXPECT_ANY_THROW
#endif
TEST
(
SchemaLoader
,
Use
)
{
SchemaLoader
loader
;
...
...
c++/src/capnp/schema-test.c++
View file @
2d67f0b8
...
...
@@ -29,11 +29,6 @@ namespace capnp {
namespace
_
{
// private
namespace
{
#if KJ_NO_EXCEPTIONS
#undef EXPECT_ANY_THROW
#define EXPECT_ANY_THROW(code) EXPECT_DEATH(code, ".")
#endif
TEST
(
Schema
,
Structs
)
{
StructSchema
schema
=
Schema
::
from
<
TestAllTypes
>
();
...
...
@@ -46,8 +41,8 @@ TEST(Schema, Structs) {
EXPECT_ANY_THROW
(
schema
.
getDependency
(
typeId
<
TestDefaults
>
()));
EXPECT_TRUE
(
schema
.
asStruct
()
==
schema
);
EXPECT_
ANY_THROW
(
schema
.
asEnum
());
EXPECT_
ANY_THROW
(
schema
.
asInterface
());
EXPECT_
NONFATAL_FAILURE
(
schema
.
asEnum
());
EXPECT_
NONFATAL_FAILURE
(
schema
.
asInterface
());
ASSERT_EQ
(
schema
.
getFields
().
size
(),
schema
.
getProto
().
getStruct
().
getFields
().
size
());
StructSchema
::
Field
field
=
schema
.
getFields
()[
0
];
...
...
@@ -126,8 +121,8 @@ TEST(Schema, Enums) {
EXPECT_ANY_THROW
(
schema
.
getDependency
(
typeId
<
TestAllTypes
>
()));
EXPECT_ANY_THROW
(
schema
.
getDependency
(
typeId
<
TestEnum
>
()));
EXPECT_
ANY_THROW
(
schema
.
asStruct
());
EXPECT_
ANY_THROW
(
schema
.
asInterface
());
EXPECT_
NONFATAL_FAILURE
(
schema
.
asStruct
());
EXPECT_
NONFATAL_FAILURE
(
schema
.
asInterface
());
EXPECT_TRUE
(
schema
.
asEnum
()
==
schema
);
ASSERT_EQ
(
schema
.
getEnumerants
().
size
(),
...
...
c++/src/capnp/test-util.c++
View file @
2d67f0b8
...
...
@@ -1015,6 +1015,7 @@ kj::Promise<void> TestMoreStuffImpl::neverReturn(NeverReturnContext context) {
// Also attach `cap` to the result struct to make sure that is released.
context
.
getResults
().
setCapCopy
(
context
.
getParams
().
getCap
());
context
.
releaseParams
();
context
.
allowCancellation
();
return
kj
::
mv
(
promise
);
}
...
...
c++/src/capnp/test-util.h
View file @
2d67f0b8
...
...
@@ -30,6 +30,20 @@
#include "dynamic.h"
#include <gtest/gtest.h>
#if KJ_NO_EXCEPTIONS
#undef EXPECT_ANY_THROW
#define EXPECT_ANY_THROW(code) EXPECT_DEATH(code, ".")
#endif
#define EXPECT_NONFATAL_FAILURE(code) \
EXPECT_TRUE(kj::runCatchingExceptions([&]() { code; }) != nullptr);
#ifdef KJ_DEBUG
#define EXPECT_DEBUG_ANY_THROW EXPECT_ANY_THROW
#else
#define EXPECT_DEBUG_ANY_THROW(EXP)
#endif
namespace
capnp
{
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Data
::
Reader
&
value
)
{
...
...
c++/src/kj/async-test.c++
View file @
2d67f0b8
...
...
@@ -614,7 +614,7 @@ TEST(Async, Detach) {
evalLater
([
&
]()
{
ran1
=
true
;
});
evalLater
([
&
]()
{
ran2
=
true
;
}).
detach
([](
kj
::
Exception
&&
)
{
ADD_FAILURE
();
});
evalLater
([]()
{
KJ_FAIL_ASSERT
(
"foo"
)
;
}).
detach
([
&
](
kj
::
Exception
&&
e
)
{
ran3
=
true
;
});
evalLater
([]()
{
KJ_FAIL_ASSERT
(
"foo"
)
{
break
;}
}).
detach
([
&
](
kj
::
Exception
&&
e
)
{
ran3
=
true
;
});
EXPECT_FALSE
(
ran1
);
EXPECT_FALSE
(
ran2
);
...
...
c++/src/kj/exception.c++
View file @
2d67f0b8
...
...
@@ -330,7 +330,8 @@ private:
getExceptionCallback
().
logMessage
(
e
.
getFile
(),
e
.
getLine
(),
0
,
str
(
e
.
getNature
(),
e
.
getDurability
()
==
Exception
::
Durability
::
TEMPORARY
?
" (temporary)"
:
""
,
e
.
getDescription
()
==
nullptr
?
""
:
": "
,
e
.
getDescription
(),
"
\n
stack: "
,
strArray
(
e
.
getStackTrace
(),
" "
),
"
\n
"
));
e
.
getStackTrace
().
size
()
>
0
?
"
\n
stack: "
:
""
,
strArray
(
e
.
getStackTrace
(),
" "
),
getStackSymbols
(
e
.
getStackTrace
()),
"
\n
"
));
}
};
...
...
c++/src/kj/mutex-test.c++
View file @
2d67f0b8
...
...
@@ -157,7 +157,13 @@ TEST(Mutex, LazyException) {
return
space
.
construct
(
456
);
});
// Unfortunately, the results differ depending on whether exceptions are enabled.
// TODO(someday): Fix this? Does it matter?
#if KJ_NO_EXCEPTIONS
EXPECT_EQ
(
123
,
i
);
#else
EXPECT_EQ
(
456
,
i
);
#endif
}
}
// namespace
...
...
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