Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
6643a9f1
Commit
6643a9f1
authored
Nov 17, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make template checks compiler-independent
parent
c3325cb5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
libcaf_core/test/logger.cpp
libcaf_core/test/logger.cpp
+13
-10
No files found.
libcaf_core/test/logger.cpp
View file @
6643a9f1
...
...
@@ -49,6 +49,13 @@ void global_fun() {
CHECK_FUN_PREFIX
(
"GLOBAL"
);
}
// Little helper that allows us to write a single check for all compilers.
// Clang expands template parameters in __PRETTY_FUNCTION__, while GCC does
// not. For example, Clang would produce "void foo<int>::bar()", while GCC
// would produce "void foo<T>::bar() [with T = int]". A type called T gives
// us always the same ouptut for the prefix.
struct
T
{};
namespace
{
struct
fixture
{
...
...
@@ -92,8 +99,8 @@ const int& ref_fun(const int& x) {
template
<
class
T
>
struct
tpl
{
static
void
run
(
std
::
string
t_name
)
{
CHECK_FUN_PREFIX
(
"$.tpl<
"
+
t_name
+
"
>"
);
static
void
run
()
{
CHECK_FUN_PREFIX
(
"$.tpl<
T
>"
);
}
};
...
...
@@ -115,8 +122,8 @@ const int& ref_fun(const int& x) {
template
<
class
T
>
struct
tpl
{
static
void
run
(
std
::
string
t_name
)
{
CHECK_FUN_PREFIX
(
"$.foo.tpl<
"
+
t_name
+
"
>"
);
static
void
run
()
{
CHECK_FUN_PREFIX
(
"$.foo.tpl<
T
>"
);
}
};
...
...
@@ -201,15 +208,11 @@ CAF_TEST(render_fun_prefix) {
fun
();
ptr_fun
(
nullptr
);
ref_fun
(
i
);
tpl
<
int
>::
run
(
"int"
);
tpl
<
unsigned
int
>::
run
(
"unsigned%20int"
);
tpl
<
tpl
<
signed
char
>>::
run
(
"$.tpl<signed%20char>"
);
tpl
<
T
>::
run
();
foo
::
fun
();
foo
::
ptr_fun
(
nullptr
);
foo
::
ref_fun
(
i
);
foo
::
tpl
<
int
>::
run
(
"int"
);
foo
::
tpl
<
unsigned
int
>::
run
(
"unsigned%20int"
);
foo
::
tpl
<
foo
::
tpl
<
signed
char
>>::
run
(
"$.foo.tpl<signed%20char>"
);
foo
::
tpl
<
T
>::
run
();
}
CAF_TEST_FIXTURE_SCOPE_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