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
dabbb358
Unverified
Commit
dabbb358
authored
Jul 29, 2023
by
Shariar Azad Riday
Committed by
GitHub
Jul 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to disable colored test output
parent
95b45696
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
libcaf_test/caf/test/reporter.cpp
libcaf_test/caf/test/reporter.cpp
+21
-3
libcaf_test/caf/test/reporter.hpp
libcaf_test/caf/test/reporter.hpp
+4
-0
libcaf_test/caf/test/runner.cpp
libcaf_test/caf/test/runner.cpp
+1
-0
No files found.
libcaf_test/caf/test/reporter.cpp
View file @
dabbb358
...
...
@@ -113,15 +113,24 @@ struct colorizing_iterator {
out
->
put
(
c
);
break
;
case
off_read_color
:
out
->
flush
();
switch
(
c
)
{
case
'0'
:
mode
=
verbatim
;
return
;
default:
mode
=
off_escape
;
return
;
}
break
;
case
off_escape
:
if
(
c
!=
'('
)
CAF_RAISE_ERROR
(
"expected ( after color code"
);
mode
=
color
;
mode
=
off_
color
;
break
;
case
off_color
:
if
(
c
==
')'
)
{
out
->
flush
();
mode
=
off
;
break
;
}
...
...
@@ -171,7 +180,9 @@ public:
}
auto
colored
()
{
return
colorizing_iterator
{
colorizing_iterator
::
normal
,
&
std
::
cout
};
auto
state
=
no_colors_
?
colorizing_iterator
::
off
:
colorizing_iterator
::
normal
;
return
colorizing_iterator
{
state
,
&
std
::
cout
};
}
void
stop
()
override
{
...
...
@@ -381,6 +392,10 @@ public:
level_
=
level
;
}
void
no_colors
(
bool
new_value
)
override
{
no_colors_
=
new_value
;
}
stats
test_stats
()
override
{
return
test_stats_
;
}
...
...
@@ -431,6 +446,9 @@ private:
/// Configures the verbosity of the reporter.
unsigned
level_
=
CAF_LOG_LEVEL_INFO
;
/// Configures whether we render text without colors.
bool
no_colors_
=
false
;
/// Stores the names of failed test suites.
std
::
vector
<
std
::
string_view
>
failed_suites_
;
...
...
libcaf_test/caf/test/reporter.hpp
View file @
dabbb358
...
...
@@ -77,6 +77,10 @@ public:
virtual
void
verbosity
(
unsigned
level
)
=
0
;
/// Sets whether the reporter disables colored output even when writing to a
/// TTY.
virtual
void
no_colors
(
bool
new_value
)
=
0
;
/// Returns statistics for the current test.
virtual
stats
test_stats
()
=
0
;
...
...
libcaf_test/caf/test/runner.cpp
View file @
dabbb358
...
...
@@ -142,6 +142,7 @@ int runner::run(int argc, char** argv) {
if
(
!
suite_regex
||
!
test_regex
)
{
return
EXIT_FAILURE
;
}
default_reporter
->
no_colors
(
get_or
(
cfg_
,
"no-colors"
,
false
));
default_reporter
->
start
();
auto
enabled
=
[](
const
std
::
regex
&
selected
,
std
::
string_view
search_string
)
{
...
...
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