mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 19:03:07 +02:00
Color
- Implemented Color::strip which can remove the color codes from a string.
This commit is contained in:
parent
93cfbf8dd2
commit
6464a2bca5
3 changed files with 33 additions and 1 deletions
|
@ -34,7 +34,7 @@ Context context;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (1033);
|
||||
UnitTest t (1036);
|
||||
|
||||
// Names matched to values.
|
||||
t.is ((int) Color (""), (int) Color (Color::nocolor), "'' == Color::nocolor");
|
||||
|
@ -182,6 +182,11 @@ int main (int argc, char** argv)
|
|||
t.is (Color::colorize ("foo", color), std::string (codes), description);
|
||||
}
|
||||
|
||||
// std::string Color::strip (const std::string&);
|
||||
t.is (Color::strip (""), "", "Color::strip '' -> ''");
|
||||
t.is (Color::strip ("foo"), "foo", "Color::strip 'foo' -> 'foo'");
|
||||
t.is (Color::strip ("f\033[1mo\033[0mo"), "foo", "Color::strip 'f<b>o</b>o' -> 'foo'");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue