From 49715320ef2f8a4312d79c6913aa59f2ca01e6d4 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 23 Apr 2016 13:30:54 -0400 Subject: [PATCH] Cleanup: Replaced "\n" with '\n' --- src/CLI.cpp | 4 +- src/Database.cpp | 2 +- src/Datafile.cpp | 14 ++-- src/Exclusion.cpp | 2 +- src/Extensions.cpp | 8 +-- src/Rules.cpp | 8 +-- src/Timeline.cpp | 2 +- src/commands/CmdDiagnostics.cpp | 40 ++++++------ src/commands/CmdExtensions.cpp | 8 +-- src/commands/CmdHelp.cpp | 110 ++++++++++++++++---------------- src/commands/CmdReport.cpp | 6 +- src/commands/CmdReportDay.cpp | 10 +-- src/commands/CmdStop.cpp | 4 +- src/commands/CmdTags.cpp | 4 +- src/helper.cpp | 16 ++--- src/init.cpp | 4 +- src/lex.cpp | 2 +- src/timew.cpp | 6 +- test/lexer.t.cpp | 2 +- test/test.cpp | 50 +++++++-------- 20 files changed, 151 insertions(+), 151 deletions(-) diff --git a/src/CLI.cpp b/src/CLI.cpp index 11ef32aa..4783bd00 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -335,13 +335,13 @@ std::string CLI::dump (const std::string& title) const out << colorArgs.colorize (i->attribute ("raw")); } - out << "\n"; + out << '\n'; if (_args.size ()) { out << " _args\n"; for (auto& a : _args) - out << " " << a.dump () << "\n"; + out << " " << a.dump () << '\n'; } return out.str (); diff --git a/src/Database.cpp b/src/Database.cpp index 19f2d6bf..1b56bdfb 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -166,7 +166,7 @@ std::string Database::dump () const std::stringstream out; out << "Database\n"; for (auto& exclusion : _exclusions) - out << " Exclusion: " << exclusion << "\n"; + out << " Exclusion: " << exclusion << '\n'; for (auto& df : _files) out << df.dump (); diff --git a/src/Datafile.cpp b/src/Datafile.cpp index a830ccb4..a2977992 100644 --- a/src/Datafile.cpp +++ b/src/Datafile.cpp @@ -154,7 +154,7 @@ void Datafile::commit () // Write out all the lines. for (auto& line : _lines) - _file.write_raw (line + "\n"); + _file.write_raw (line + '\n'); _file.close (); _dirty = false; @@ -169,13 +169,13 @@ std::string Datafile::dump () const { std::stringstream out; out << "Datafile\n" - << " Name: " << _file.name () << (_file.exists () ? "" : " (does not exist)") << "\n" - << " dirty: " << (_dirty ? "true" : "false") << "\n" - << " lines: " << _lines.size () << "\n" - << " loaded " << (_lines_loaded ? "true" : "false") << "\n" - << " exclusions: " << _exclusions.size () << "\n" + << " Name: " << _file.name () << (_file.exists () ? "" : " (does not exist)") << '\n' + << " dirty: " << (_dirty ? "true" : "false") << '\n' + << " lines: " << _lines.size () << '\n' + << " loaded " << (_lines_loaded ? "true" : "false") << '\n' + << " exclusions: " << _exclusions.size () << '\n' << " range: " << _range.start.toISO () << " - " - << _range.end.toISO () << "\n"; + << _range.end.toISO () << '\n'; return out.str (); } diff --git a/src/Exclusion.cpp b/src/Exclusion.cpp index e9e3a0d9..310a207f 100644 --- a/src/Exclusion.cpp +++ b/src/Exclusion.cpp @@ -148,7 +148,7 @@ std::string Exclusion::serialize () const //////////////////////////////////////////////////////////////////////////////// std::string Exclusion::dump () const { - return std::string ("Exclusion ") + join (" ", _tokens) + "\n"; + return std::string ("Exclusion ") + join (" ", _tokens) + '\n'; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/Extensions.cpp b/src/Extensions.cpp index b5e0d50d..2588be1b 100644 --- a/src/Extensions.cpp +++ b/src/Extensions.cpp @@ -68,11 +68,11 @@ int Extensions::callExtension ( { if (_debug) { - std::cout << "Extension: Calling " << script << "\n" + std::cout << "Extension: Calling " << script << '\n' << "Extension: input"; for (auto& i : input) - std::cout << " " << i << "\n"; + std::cout << " " << i << '\n'; } auto inputStr = join ("\n", input); @@ -94,7 +94,7 @@ int Extensions::callExtension ( output = split (outputStr, '\n'); if (_debug) - std::cout << "Extension: Completed with status " << status << "\n"; + std::cout << "Extension: Completed with status " << status << '\n'; return status; } @@ -106,7 +106,7 @@ std::string Extensions::dump () const out << "Extensions\n"; for (auto& script : _scripts) - out << " " << script << "\n"; + out << " " << script << '\n'; return out.str (); } diff --git a/src/Rules.cpp b/src/Rules.cpp index ba782966..d8ae4b01 100644 --- a/src/Rules.cpp +++ b/src/Rules.cpp @@ -170,11 +170,11 @@ std::string Rules::dump () const std::stringstream out; out << "Rules\n" << " _original_file " << _original_file - << "\n"; + << '\n'; out << " Settings\n"; for (auto& item : _settings) - out << " " << item.first << "=" << item.second << "\n"; + out << " " << item.first << "=" << item.second << '\n'; return out.str (); } @@ -212,7 +212,7 @@ void Rules::parse (const std::string& input, int nest /* = 1 */) } else { - ruleDef += line + "\n"; + ruleDef += line + '\n'; } } @@ -235,7 +235,7 @@ void Rules::parse (const std::string& input, int nest /* = 1 */) } inRule = true; - ruleDef = line + "\n"; + ruleDef = line + '\n'; } // Top-level import: diff --git a/src/Timeline.cpp b/src/Timeline.cpp index ff442473..dfdf71ac 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -117,7 +117,7 @@ std::string Timeline::dump () const { std::stringstream out; - out << "Timeline range " << range.dump () << "\n"; + out << "Timeline range " << range.dump () << '\n'; for (auto& i : _inclusions) out << " " << i.json (); for (auto& e : _exclusions) diff --git a/src/commands/CmdDiagnostics.cpp b/src/commands/CmdDiagnostics.cpp index 30fa69a7..bec33b07 100644 --- a/src/commands/CmdDiagnostics.cpp +++ b/src/commands/CmdDiagnostics.cpp @@ -68,9 +68,9 @@ int CmdDiagnostics ( const Extensions& extensions) { std::stringstream out; - out << "\n" + out << '\n' << PACKAGE_STRING - << "\n"; + << '\n'; out << " Platform: " << osName () << "\n\n"; @@ -78,7 +78,7 @@ int CmdDiagnostics ( // Compiler. out << "Compiler:\n" #ifdef __VERSION__ - << " Version: " << __VERSION__ << "\n" + << " Version: " << __VERSION__ << '\n' #endif << " Caps:" #ifdef __STDC__ @@ -107,7 +107,7 @@ int CmdDiagnostics ( << " +l" << 8 * sizeof (long) << " +vp" << 8 * sizeof (void*) << " +time_t" << 8 * sizeof (time_t) - << "\n"; + << '\n'; // Compiler compliance level. std::string compliance = "non-compliant"; @@ -127,11 +127,11 @@ int CmdDiagnostics ( out << "Build Features\n" // Build date. - << " Built: " << __DATE__ << " " << __TIME__ << "\n" + << " Built: " << __DATE__ << " " << __TIME__ << '\n' #ifdef HAVE_COMMIT - << " Commit: " << COMMIT << "\n" + << " Commit: " << COMMIT << '\n' #endif - << " CMake: " << CMAKE_VERSION << "\n"; + << " CMake: " << CMAKE_VERSION << '\n'; out << " Build type: " #ifdef CMAKE_BUILD_TYPE @@ -152,37 +152,37 @@ int CmdDiagnostics ( << ", mode " << std::setbase (8) << context.config._original_file.mode () - << "\n"; + << '\n'; */ char* env = getenv ("TIMEWARRIORDB"); out << " TIMEWARRIORDB: " << (env ? env : "-") - << "\n"; + << '\n'; File cfg (rules.get ("temp.db") + "/timewarrior.cfg"); - out << " Cfg: " << describeFile (cfg) << "\n"; + out << " Cfg: " << describeFile (cfg) << '\n'; Directory db (rules.get ("temp.db")); - out << " Database: " << describeFile (db) << "\n"; + out << " Database: " << describeFile (db) << '\n'; for (auto& file : database.files ()) { File df (rules.get ("temp.db") + "/data"); df += file; - out << " " << describeFile (df) << "\n"; + out << " " << describeFile (df) << '\n'; } // Determine rc.editor/$EDITOR/$VISUAL. char* peditor; if ((peditor = getenv ("VISUAL")) != NULL) - out << " $VISUAL: " << peditor << "\n"; + out << " $VISUAL: " << peditor << '\n'; else if ((peditor = getenv ("EDITOR")) != NULL) - out << " $EDITOR: " << peditor << "\n"; + out << " $EDITOR: " << peditor << '\n'; // Theme description, if present. if (rules.has ("theme.description")) - out << " Color theme: " << rules.get ("theme.description") << "\n"; + out << " Color theme: " << rules.get ("theme.description") << '\n'; else out << " Color theme: Default theme\n"; @@ -196,17 +196,17 @@ int CmdDiagnostics ( out << "\n "; out << ' ' << palette.next ().colorize (rightJustifyZero (color, 2)); } - out << "\n"; + out << '\n'; } - out << "\n"; + out << '\n'; // Display extensions. Directory extDir (rules.get ("temp.db")); extDir += "extensions"; out << "Extensions\n" - << " Location: " << describeFile (extDir) << "\n"; + << " Location: " << describeFile (extDir) << '\n'; auto exts = extensions.all (); if (exts.size ()) @@ -224,13 +224,13 @@ int CmdDiagnostics ( out << " "; out.width (longest); - out << describeFile (file) << "\n"; + out << describeFile (file) << '\n'; } } else out << " (None)\n"; - out << "\n"; + out << '\n'; std::cout << out.str (); return 0; diff --git a/src/commands/CmdExtensions.cpp b/src/commands/CmdExtensions.cpp index eb6bad33..96e86ee1 100644 --- a/src/commands/CmdExtensions.cpp +++ b/src/commands/CmdExtensions.cpp @@ -65,12 +65,12 @@ int CmdExtensions ( Directory extDir (rules.get ("temp.db")); extDir += "extensions"; - std::cout << "\n" + std::cout << '\n' << "Extensions located in:\n" - << " " << extDir._data << "\n" - << "\n" + << " " << extDir._data << '\n' + << '\n' << t.render () - << "\n"; + << '\n'; return 0; } diff --git a/src/commands/CmdHelp.cpp b/src/commands/CmdHelp.cpp index f55e362a..5441be5a 100644 --- a/src/commands/CmdHelp.cpp +++ b/src/commands/CmdHelp.cpp @@ -32,7 +32,7 @@ int CmdHelpUsage () { // TODO This is going to need formatting. - std::cout << "\n" + std::cout << '\n' << "Usage: timew [--version]\n" << " timew continue\n" << " timew diagnostics\n" @@ -44,7 +44,7 @@ int CmdHelpUsage () << " timew stop [ ...]\n" << " timew tags\n" << " timew track [ ...]\n" - << "\n" + << '\n' << "Interval:\n" << " [from] \n" << " [from] to/- \n" @@ -52,13 +52,13 @@ int CmdHelpUsage () << " before \n" << " after \n" << " \n" - << "\n" + << '\n' << "Tag:\n" << " Word\n" << " 'Single Quoted Words'\n" << " \"Double Quoted Words\"\n" << " Escaped\\ Spaces\n" - << "\n"; + << '\n'; // TODO clear // TODO config @@ -99,109 +99,109 @@ int CmdHelp (const CLI& cli) // Ruler 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 if (words[0] == "continue") - std::cout << "\n" + std::cout << '\n' << "Syntax: timew continue\n" - << "\n" + << '\n' << "Resumes tracking the most recently closed interval. For exqample:\n" - << "\n" + << '\n' << " $ timew track 9am - 5pm tag1 tag2\n" << " $ timew continue\n" - << "\n" + << '\n' << "The 'continue' command creates a new interval, starting now, and using the tags\n" << "'tag1' and 'tag2'.\n" - << "\n" + << '\n' << "See also 'start', 'stop'.\n" - << "\n"; + << '\n'; // TODO day // Ruler 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 else if (words[0] == "diagnostics") - std::cout << "\n" + std::cout << '\n' << "Syntax: timew diagnostics\n" - << "\n" + << '\n' << "This command shows details about your version of Timewarrior, platform, how it\n" << "was built, compiler features, configuration, file access, extensions and more.\n" - << "\n" + << '\n' << "The purpose of this command is to help diagnose configuration problems, and\n" << "provide supplemental information when reporting a problem.\n" - << "\n" + << '\n' << "See also 'extensions'.\n" - << "\n"; + << '\n'; // Ruler 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 else if (words[0] == "export") - std::cout << "\n" + std::cout << '\n' << "Syntax: timew export [] [ ...]\n" - << "\n" + << '\n' << "Exports all the tracked time in JSON format. Supports filtering. For example:\n" - << "\n" + << '\n' << " $ timew export from 2016-01-01 for 3wks tag1\n" - << "\n" + << '\n' << "See also 'import'.\n" - << "\n"; + << '\n'; // Ruler 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 else if (words[0] == "extensions") - std::cout << "\n" + std::cout << '\n' << "Syntax: timew extensions\n" - << "\n" + << '\n' << "Displays the directory containing the extension programs, and a table showing\n" << "each extensions and its status.\n" - << "\n" + << '\n' << "See also 'diagnostics'.\n" - << "\n"; + << '\n'; // TODO gaps // Ruler 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 else if (words[0] == "help") - std::cout << "\n" + std::cout << '\n' << "The help command shows detailed descriptions and examples of commands and the\n" << "supported hints. For example:\n" - << "\n" + << '\n' << " $ timew help\n" << " $ timew help start\n" << " $ timew help hints\n" - << "\n"; + << '\n'; // Ruler 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 else if (words[0] == "hints") - std::cout << "\n" + std::cout << '\n' << "Timewarrior supports hints, which are single-word command line features that\n" << "start with a colon like this:\n" - << "\n" + << '\n' << " :week\n" - << "\n" + << '\n' << "Hints serve several purposes. This example is a shortcut for the date range\n" << "that defines the current week. Other hints, such as:\n" - << "\n" + << '\n' << " :quiet\n" - << "\n" + << '\n' << "are ways to control the behavior of Timewarrior, in this case eliminating all\n" << "forms of feedback, for purposes of automation. The supported hints are:\n" - << "\n" + << '\n' << " :quiet Turns off all feedback. For automation\n" << " :debug Runs in debug mode, shows many runtime details\n" - << "\n" + << '\n' << " :color Force color on, even if not connected to a TTY\n" << " :nocolor Force color off, even if connected to a TTY\n" - << "\n" + << '\n' << " :yesterday The 24 hours of the previous day\n" << " :day The 24 hours of the current day\n" << " :week This week\n" << " :month This month\n" << " :quarter This quarter\n" << " :year This year\n" - << "\n" + << '\n' << " :fill Expand time to fill surrounding available gap\n" << " Only functions when exclusions are provided\n" - << "\n"; + << '\n'; // TODO import // TODO month @@ -211,57 +211,57 @@ int CmdHelp (const CLI& cli) // Ruler 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 else if (words[0] == "start") - std::cout << "\n" + std::cout << '\n' << "Syntax: timew start [] [ ...]\n" - << "\n" + << '\n' << "Begins tracking using the current time, and the specified optional set of tags.\n" << "If a tag contains multiple words, and therefore contains spaces, use quotes to\n" << "surround the whole tag. For example, this command specifies two tags ('weekend'\n" << "and 'Home & Garden'), the second of which requires quotes.\n" - << "\n" + << '\n' << " $ timew start weekend 'Home & Garden'\n" - << "\n" + << '\n' << "An optional date may be specified to indicate the intended start to the tracked\n" << "time:\n" - << "\n" + << '\n' << " $ time start 8am weekend 'Home & Garden'\n" - << "\n" + << '\n' << "Quotes are harmless if used unecessarily.\n" - << "\n" + << '\n' << "See also 'continue', 'stop', 'track'.\n" - << "\n"; + << '\n'; // Ruler 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 else if (words[0] == "stop") - std::cout << "\n" + std::cout << '\n' << "Syntax: timew stop [ ...]\n" - << "\n" + << '\n' << "Stops tracking time. If tags are specified, then they are no longer tracked.\n" << "If no tags are specified, all tracking stops. For example:\n" - << "\n" + << '\n' << " $ timew start tag1 tag2\n" << " ...\n" << " $ timew stop tag1\n" - << "\n" + << '\n' << "Initially time is tracked for both 'tag1' and 'tag2', then 'tag1' tracking is\n" << "stopped, leaving tag2 active. To stop all tracking:\n" - << "\n" + << '\n' << " $ timew stop\n" - << "\n" + << '\n' << "See also 'continue', 'start', 'track'.\n" - << "\n"; + << '\n'; // TODO summary // Ruler 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 else if (words[0] == "tags") - std::cout << "\n" + std::cout << '\n' << "Syntax: timew tags\n" - << "\n" + << '\n' << "Displays all the tags that have been used.\n" - << "\n"; + << '\n'; // TODO track // TODO undo diff --git a/src/commands/CmdReport.cpp b/src/commands/CmdReport.cpp index d9f6efaf..a05d6dc6 100644 --- a/src/commands/CmdReport.cpp +++ b/src/commands/CmdReport.cpp @@ -97,10 +97,10 @@ int CmdReport ( std::stringstream header; for (auto& name : rules.all ()) - header << name << ": " << rules.get (name) << "\n"; + header << name << ": " << rules.get (name) << '\n'; auto input = header.str () - + "\n" + + '\n' + jsonFromIntervals (intervals); // Run the extensions. @@ -109,7 +109,7 @@ int CmdReport ( // Display the output. for (auto& line : output) - std::cout << line << "\n"; + std::cout << line << '\n'; return 0; } diff --git a/src/commands/CmdReportDay.cpp b/src/commands/CmdReportDay.cpp index 7b8a5027..5f137c6b 100644 --- a/src/commands/CmdReportDay.cpp +++ b/src/commands/CmdReportDay.cpp @@ -63,20 +63,20 @@ int CmdReportDay ( // TODO Axis, hard-coded. std::string indent = " "; - std::cout << "\n" + std::cout << '\n' << indent << "0 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11\n"; // TODO Data, missing. - std::cout << "\n" - << "\n"; + std::cout << '\n' + << '\n'; // TODO Summary, missing. - std::cout << "\n" + std::cout << '\n' << indent << "Tracked\n" << indent << "Untracked\n" << indent << "Total\n" - << "\n"; + << '\n'; return 0; } diff --git a/src/commands/CmdStop.cpp b/src/commands/CmdStop.cpp index bfefc5cf..52c9ddbe 100644 --- a/src/commands/CmdStop.cpp +++ b/src/commands/CmdStop.cpp @@ -71,14 +71,14 @@ int CmdStop ( // User feedback. if (rules.getBoolean ("verbose")) - std::cout << "\n" << intervalSummarize (rules, latest); + std::cout << '\n' << intervalSummarize (rules, latest); } } else { std::string message = "There is no active time tracking."; if (rules.getBoolean ("verbose")) - std::cout << message << "\n"; + std::cout << message << '\n'; } return 0; diff --git a/src/commands/CmdTags.cpp b/src/commands/CmdTags.cpp index 46459855..eb465158 100644 --- a/src/commands/CmdTags.cpp +++ b/src/commands/CmdTags.cpp @@ -68,9 +68,9 @@ int CmdTags (Rules& rules, Database& database) t.set (row, 1, rules.has (name) ? rules.get (name) : "-"); } - std::cout << "\n" + std::cout << '\n' << t.render () - << "\n"; + << '\n'; } else std::cout << "No data found.\n"; diff --git a/src/helper.cpp b/src/helper.cpp index daae7d41..ecc62c0e 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -67,21 +67,21 @@ std::string intervalSummarize (const Rules& rules, const Interval& interval) if (interval.range.ended ()) { Duration dur (Datetime (interval.range.end) - Datetime (interval.range.start)); - out << "Recorded " << tags << "\n" - << " Started " << interval.range.start.toISOLocalExtended () << "\n" - << " Ended " << interval.range.end.toISOLocalExtended () << "\n" - << " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << "\n"; + out << "Recorded " << tags << '\n' + << " Started " << interval.range.start.toISOLocalExtended () << '\n' + << " Ended " << interval.range.end.toISOLocalExtended () << '\n' + << " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << '\n'; } // Interval open. else { Duration dur (Datetime () - interval.range.start); - out << "Tracking " << tags << "\n" - << " Started " << interval.range.start.toISOLocalExtended () << "\n"; + out << "Tracking " << tags << '\n' + << " Started " << interval.range.start.toISOLocalExtended () << '\n'; if (dur.toTime_t () > 10) - out << " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << "\n"; + out << " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << '\n'; } } @@ -390,7 +390,7 @@ std::string jsonFromIntervals (const std::vector & intervals) } if (counter) - out << "\n"; + out << '\n'; out << "]\n"; return out.str (); diff --git a/src/init.cpp b/src/init.cpp index d173059a..a93aa018 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -46,7 +46,7 @@ bool lightweightVersionCheck (int argc, const char** argv) { if (argc == 2 && std::string (argv[1]) == "--version") { - std::cout << VERSION << "\n"; + std::cout << VERSION << '\n'; return true; } @@ -232,7 +232,7 @@ int dispatchCommand ( // Debug output. if (rules.getBoolean ("debug")) - std::cout << cli.dump () << "\n"; + std::cout << cli.dump () << '\n'; // Dispatch to the right command function. std::string command = cli.getCommand (); diff --git a/src/lex.cpp b/src/lex.cpp index 2a968627..e625e2b7 100644 --- a/src/lex.cpp +++ b/src/lex.cpp @@ -13,7 +13,7 @@ int main (int argc, char** argv) std::string token; Lexer::Type type; while (l.token (token, type)) - std::cout << " token '" << token << "' " << Lexer::typeToString (type) << "\n"; + std::cout << " token '" << token << "' " << Lexer::typeToString (type) << '\n'; } } diff --git a/src/timew.cpp b/src/timew.cpp index 7c7dae99..b28edbea 100644 --- a/src/timew.cpp +++ b/src/timew.cpp @@ -85,21 +85,21 @@ int main (int argc, const char** argv) catch (const std::string& error) { - std::cerr << error << "\n"; + std::cerr << error << '\n'; status = -1; } catch (std::bad_alloc& error) { auto message = std::string ("Memory allocation failed: ") + error.what (); - std::cerr << "Error: " << message << "\n"; + std::cerr << "Error: " << message << '\n'; status = -3; } catch (...) { auto message = "Unknown problem, please report."; - std::cerr << "Error: " << message << "\n"; + std::cerr << "Error: " << message << '\n'; status = -2; } diff --git a/test/lexer.t.cpp b/test/lexer.t.cpp index bcde2c3b..f345af88 100644 --- a/test/lexer.t.cpp +++ b/test/lexer.t.cpp @@ -59,7 +59,7 @@ int main (int, char**) tokens.clear (); while (l3.token (token, type)) { - std::cout << "# «" << token << "» " << Lexer::typeName (type) << "\n"; + std::cout << "# «" << token << "» " << Lexer::typeName (type) << '\n'; tokens.push_back (std::pair (token, type)); } diff --git a/test/test.cpp b/test/test.cpp index 60ddd3cf..e74d43bc 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -51,7 +51,7 @@ UnitTest::UnitTest (int planned) , _failed (0) , _skipped (0) { - std::cout << "1.." << _planned << "\n"; + std::cout << "1.." << _planned << '\n'; } /////////////////////////////////////////////////////////////////////////////// @@ -99,14 +99,14 @@ void UnitTest::plan (int planned) _failed = 0; _skipped = 0; - std::cout << "1.." << _planned << "\n"; + std::cout << "1.." << _planned << '\n'; } /////////////////////////////////////////////////////////////////////////////// void UnitTest::planMore (int extra) { _planned += extra; - std::cout << "1.." << _planned << "\n"; + std::cout << "1.." << _planned << '\n'; } /////////////////////////////////////////////////////////////////////////////// @@ -122,7 +122,7 @@ void UnitTest::ok (bool expression, const std::string& name) << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -132,7 +132,7 @@ void UnitTest::ok (bool expression, const std::string& name) << _counter << " - " << name - << "\n"; + << '\n'; } } @@ -149,7 +149,7 @@ void UnitTest::notok (bool expression, const std::string& name) << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -159,7 +159,7 @@ void UnitTest::notok (bool expression, const std::string& name) << _counter << " - " << name - << "\n"; + << '\n'; } } @@ -175,7 +175,7 @@ void UnitTest::is (bool actual, bool expected, const std::string& name) << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -189,7 +189,7 @@ void UnitTest::is (bool actual, bool expected, const std::string& name) << expected << "\n# got: " << actual - << "\n"; + << '\n'; } } @@ -205,7 +205,7 @@ void UnitTest::is (size_t actual, size_t expected, const std::string& name) << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -219,7 +219,7 @@ void UnitTest::is (size_t actual, size_t expected, const std::string& name) << expected << "\n# got: " << actual - << "\n"; + << '\n'; } } @@ -235,7 +235,7 @@ void UnitTest::is (int actual, int expected, const std::string& name) << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -249,7 +249,7 @@ void UnitTest::is (int actual, int expected, const std::string& name) << expected << "\n# got: " << actual - << "\n"; + << '\n'; } } @@ -265,7 +265,7 @@ void UnitTest::is (double actual, double expected, const std::string& name) << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -279,7 +279,7 @@ void UnitTest::is (double actual, double expected, const std::string& name) << expected << "\n# got: " << actual - << "\n"; + << '\n'; } } @@ -295,7 +295,7 @@ void UnitTest::is (double actual, double expected, double tolerance, const std:: << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -309,7 +309,7 @@ void UnitTest::is (double actual, double expected, double tolerance, const std:: << expected << "\n# got: " << actual - << "\n"; + << '\n'; } } @@ -325,7 +325,7 @@ void UnitTest::is (unsigned char actual, unsigned char expected, const std::stri << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -339,7 +339,7 @@ void UnitTest::is (unsigned char actual, unsigned char expected, const std::stri << expected << "\n# got: " << actual - << "\n"; + << '\n'; } } @@ -358,7 +358,7 @@ void UnitTest::is ( << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -392,7 +392,7 @@ void UnitTest::is ( << _counter << " - " << name - << "\n"; + << '\n'; } else { @@ -418,7 +418,7 @@ void UnitTest::diag (const std::string& text) auto end = text.find_last_not_of (" \t\n\r\f"); if (start != std::string::npos && end != std::string::npos) - std::cout << "# " << text.substr (start, end - start + 1) << "\n"; + std::cout << "# " << text.substr (start, end - start + 1) << '\n'; } /////////////////////////////////////////////////////////////////////////////// @@ -431,7 +431,7 @@ void UnitTest::pass (const std::string& text) << _counter << " - " << text - << "\n"; + << '\n'; } /////////////////////////////////////////////////////////////////////////////// @@ -444,7 +444,7 @@ void UnitTest::fail (const std::string& text) << _counter << " - " << text - << "\n"; + << '\n'; } /////////////////////////////////////////////////////////////////////////////// @@ -457,7 +457,7 @@ void UnitTest::skip (const std::string& text) << _counter << " - " << text - << "\n"; + << '\n'; } ///////////////////////////////////////////////////////////////////////////////