Fixed time-matching in tests.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Because remwharead converts time_points to local time, the string is different depending on the timezone you are in.
This commit is contained in:
parent
a64c4862b9
commit
a3eb01ff2e
|
@ -57,14 +57,16 @@ SCENARIO ("The AsciiDoc export works correctly")
|
|||
":TOC: +right\n\n");
|
||||
const regex re_dates
|
||||
("== 1970-01-01\n\n"
|
||||
"\\[\\[dt1970-01-01T01:00:00\\]\\]\n"
|
||||
"\\[\\[dt1970-01-01T\\d{2}:\\d{2}:\\d{2}\\]\\]\n"
|
||||
"\\.link:https://example\\.com/page\\.html\\[Nice title\\]\n"
|
||||
"_01:00:00_ xref:tag1\\[tag1\\], xref:tag2\\[tag2\\]\n\n"
|
||||
"_\\d{2}:\\d{2}:\\d{2}_ "
|
||||
"xref:tag1\\[tag1\\], xref:tag2\\[tag2\\]\n\n"
|
||||
"Good description\\.\n");
|
||||
const regex re_tags
|
||||
("== Tags\n\n"
|
||||
"=== \\[\\[tag1\\]\\]tag1\n\n"
|
||||
"\\* xref:dt1970-01-01T01:00:00\\[Nice title\\]\n\n");
|
||||
"\\* xref:dt1970-01-01T\\d{2}:\\d{2}:\\d{2}"
|
||||
"\\[Nice title\\]\n\n");
|
||||
|
||||
for (const regex &re : { re_header, re_dates, re_tags })
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <string>
|
||||
#include <chrono>
|
||||
#include <sstream>
|
||||
#include <regex>
|
||||
#include <catch.hpp>
|
||||
#include "time.hpp"
|
||||
#include "sqlite.hpp"
|
||||
|
@ -25,6 +26,8 @@
|
|||
|
||||
using std::string;
|
||||
using std::chrono::system_clock;
|
||||
using std::regex;
|
||||
using std::regex_search;
|
||||
|
||||
SCENARIO ("The CSV export works correctly")
|
||||
{
|
||||
|
@ -45,19 +48,18 @@ SCENARIO ("The CSV export works correctly")
|
|||
{
|
||||
std::ostringstream output;
|
||||
export_csv({ entry }, output);
|
||||
const string csv = output.str();
|
||||
|
||||
const string expected =
|
||||
"\"URI\",\"Archived URI\",\"Date & time\",\"Tags\","
|
||||
const regex re
|
||||
("\"URI\",\"Archived URI\",\"Date & time\",\"Tags\","
|
||||
"\"Title\",\"Description\",\"Full text\"\r\n"
|
||||
"\"https://example.com/page.html\",\"\","
|
||||
"\"1970-01-01T01:00:00\",\"tag1,tag2\","
|
||||
"\"Nice title\",\"Good description.\",\"Full text.\"\r\n";
|
||||
if (output.str() == expected)
|
||||
"\"1970-01-01T\\d{2}:\\d{2}:\\d{2}\",\"tag1,tag2\","
|
||||
"\"Nice title\",\"Good description.\",\"Full text.\"\r\n");
|
||||
if (regex_search(csv, re))
|
||||
{
|
||||
csv_ok = true;
|
||||
}
|
||||
std::cout << "|" << output.str() << "|\n"
|
||||
<< "|" << expected << "|\n";
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue