summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis van der Schagt <dennisschagt@gmail.com>2022-05-28 18:22:47 +0200
committerDennis van der Schagt <dennisschagt@gmail.com>2022-05-28 18:22:47 +0200
commita53172acc399391a20c1b0e11c7b29d53403aea7 (patch)
tree791acda63a68492bf0e6d2b482341f9b575df115
parent6b06dfbcc0aff68c7ce72ece84a9f6076cf14827 (diff)
Name test_helpers namespace according to style guide
-rw-r--r--test/cache.cpp30
-rw-r--r--test/cliargsparser.cpp102
-rw-r--r--test/configparser.cpp4
-rw-r--r--test/configpaths.cpp240
-rw-r--r--test/controller.cpp6
-rw-r--r--test/fileurlreader.cpp14
-rw-r--r--test/fslock.cpp10
-rw-r--r--test/history.cpp4
-rw-r--r--test/itemlistformaction.cpp30
-rw-r--r--test/itemrenderer.cpp12
-rw-r--r--test/opml.cpp12
-rw-r--r--test/queueloader.cpp112
-rw-r--r--test/queuemanager.cpp108
-rw-r--r--test/rssfeed.cpp6
-rw-r--r--test/rssitem.cpp8
-rw-r--r--test/rsspp_parser.cpp4
-rw-r--r--test/rsspp_rssparser.cpp2
-rw-r--r--test/scopemeasure.cpp8
-rw-r--r--test/test-helpers/chdir.cpp6
-rw-r--r--test/test-helpers/chdir.h4
-rw-r--r--test/test-helpers/chmod.cpp8
-rw-r--r--test/test-helpers/chmod.h4
-rw-r--r--test/test-helpers/envvar.cpp48
-rw-r--r--test/test-helpers/envvar.h4
-rw-r--r--test/test-helpers/exceptionwithmsg.h4
-rw-r--r--test/test-helpers/loggerresetter.cpp4
-rw-r--r--test/test-helpers/loggerresetter.h4
-rw-r--r--test/test-helpers/maintempdir.cpp10
-rw-r--r--test/test-helpers/maintempdir.h4
-rw-r--r--test/test-helpers/misc.cpp26
-rw-r--r--test/test-helpers/misc.h4
-rw-r--r--test/test-helpers/opts.cpp6
-rw-r--r--test/test-helpers/opts.h4
-rw-r--r--test/test-helpers/tempdir.cpp6
-rw-r--r--test/test-helpers/tempdir.h4
-rw-r--r--test/test-helpers/tempfile.cpp6
-rw-r--r--test/test-helpers/tempfile.h4
-rw-r--r--test/utils.cpp22
38 files changed, 447 insertions, 447 deletions
diff --git a/test/cache.cpp b/test/cache.cpp
index 009df7a3..a41d7b6f 100644
--- a/test/cache.cpp
+++ b/test/cache.cpp
@@ -37,7 +37,7 @@ TEST_CASE("items in search result can be marked read", "[Cache]")
TEST_CASE("Cleaning old articles works", "[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
std::unique_ptr<ConfigContainer> cfg(new ConfigContainer());
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), cfg.get()));
RssParser parser(
@@ -78,7 +78,7 @@ TEST_CASE("Cleaning old articles works", "[Cache]")
TEST_CASE("Last-Modified and ETag values are persisted to DB", "[Cache]")
{
std::unique_ptr<ConfigContainer> cfg(new ConfigContainer());
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), cfg.get()));
const auto feedurl = "file://data/rss.xml";
RssParser parser(feedurl, rsscache.get(), cfg.get(), nullptr);
@@ -233,7 +233,7 @@ TEST_CASE(
"and `delete-read-articles-on-quit` settings",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
std::vector<std::string> feedurls = {
"file://data/rss.xml", "file://data/atom10_1.xml"
@@ -369,7 +369,7 @@ TEST_CASE("fetch_descriptions fills out feed item's descriptions", "[Cache]")
TEST_CASE("get_read_item_guids returns GUIDs of items that are marked read",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
@@ -429,7 +429,7 @@ TEST_CASE("get_read_item_guids returns GUIDs of items that are marked read",
TEST_CASE("mark_item_deleted changes \"deleted\" flag of item with given GUID ",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
auto feedurl = "file://data/rss.xml";
@@ -451,7 +451,7 @@ TEST_CASE("mark_item_deleted changes \"deleted\" flag of item with given GUID ",
TEST_CASE("mark_items_read_by_guid marks items with given GUIDs as unread ",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
auto feedurl = "file://data/rss.xml";
@@ -575,7 +575,7 @@ TEST_CASE("search_for_items finds all items with matching title or content",
TEST_CASE("update_rssitem_flags dumps `rss_item` object's flags to DB",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
const auto feedurl = "file://data/rss.xml";
@@ -598,7 +598,7 @@ TEST_CASE(
"\"enqueued\" fields",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
const auto feedurl = "file://data/rss.xml";
@@ -697,7 +697,7 @@ TEST_CASE(
}
};
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
const auto feedurl = "file://data/rss.xml";
@@ -733,7 +733,7 @@ TEST_CASE(
TEST_CASE("externalize_rssfeed doesn't store more than `max-items` items",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
std::unique_ptr<ConfigContainer> cfg(new ConfigContainer());
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), cfg.get()));
@@ -760,7 +760,7 @@ TEST_CASE(
"not counting the flagged ones",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
std::unique_ptr<ConfigContainer> cfg(new ConfigContainer());
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), cfg.get()));
@@ -840,7 +840,7 @@ TEST_CASE(
"changed and reset_unread = \"yes\"",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
auto feedurl = "file://data/rss.xml";
@@ -876,7 +876,7 @@ TEST_CASE(
"is set",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
auto feedurl = "file://data/rss.xml";
@@ -911,7 +911,7 @@ TEST_CASE(
"when passed a query feed",
"[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
@@ -967,7 +967,7 @@ TEST_CASE(
TEST_CASE("do_vacuum doesn't throw an exception", "[Cache]")
{
- TestHelpers::TempFile dbfile;
+ test_helpers::TempFile dbfile;
ConfigContainer cfg;
std::unique_ptr<Cache> rsscache(new Cache(dbfile.get_path(), &cfg));
RssParser parser("file://data/rss.xml", rsscache.get(), &cfg, nullptr);
diff --git a/test/cliargsparser.cpp b/test/cliargsparser.cpp
index 710f6252..ecbfd024 100644
--- a/test/cliargsparser.cpp
+++ b/test/cliargsparser.cpp
@@ -15,7 +15,7 @@ TEST_CASE(
"provided",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.should_print_usage());
@@ -46,7 +46,7 @@ TEST_CASE(
{
const std::string filename("blogroll.opml");
- auto check = [&filename](TestHelpers::Opts opts) {
+ auto check = [&filename](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.do_import());
@@ -65,15 +65,15 @@ TEST_CASE(
TEST_CASE("Resolves tilde to homedir in -i/--import-from-opml",
"[CliArgsParser]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
const std::string filename("feedlist.opml");
const std::string arg = std::string("~/") + filename;
- auto check = [&filename, &tmp](TestHelpers::Opts opts) {
+ auto check = [&filename, &tmp](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.do_import());
@@ -97,7 +97,7 @@ TEST_CASE(
const std::string importf("import.opml");
const std::string exportf("export.opml");
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.should_print_usage());
@@ -116,7 +116,7 @@ TEST_CASE(
TEST_CASE("Sets `refresh_on_start` if -r/--refresh-on-start is provided",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.refresh_on_start());
@@ -134,7 +134,7 @@ TEST_CASE("Sets `refresh_on_start` if -r/--refresh-on-start is provided",
TEST_CASE("Requests silent mode if -e/--export-to-opml is provided",
"[CliArgsParser]")
{
- const TestHelpers::Opts opts{"newsboat", "-e"};
+ const test_helpers::Opts opts{"newsboat", "-e"};
CliArgsParser args(opts.argc(), opts.argv());
@@ -144,7 +144,7 @@ TEST_CASE("Requests silent mode if -e/--export-to-opml is provided",
TEST_CASE("Sets `do_export` if -e/--export-to-opml is provided",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.do_export());
@@ -162,7 +162,7 @@ TEST_CASE("Sets `do_export` if -e/--export-to-opml is provided",
TEST_CASE("Asks to print usage and exit with success if -h/--help is provided",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.should_print_usage());
@@ -185,7 +185,7 @@ TEST_CASE(
{
const std::string filename("urlfile");
- auto check = [&filename](TestHelpers::Opts opts) {
+ auto check = [&filename](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.url_file() == filename);
@@ -203,15 +203,15 @@ TEST_CASE(
TEST_CASE("Resolves tilde to homedir in -u/--url-file", "[CliArgsParser]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
const std::string filename("urlfile");
const std::string arg = std::string("~/") + filename;
- auto check = [&filename, &tmp](TestHelpers::Opts opts) {
+ auto check = [&filename, &tmp](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.url_file() == tmp.get_path() + filename);
@@ -233,7 +233,7 @@ TEST_CASE(
{
const std::string filename("cache.db");
- auto check = [&filename](TestHelpers::Opts opts) {
+ auto check = [&filename](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.cache_file() == filename);
@@ -254,7 +254,7 @@ TEST_CASE("Supports combined short options", "[CliArgsParser]")
{
const std::string filename("cache.db");
- TestHelpers::Opts opts = {"newsboat", "-vc", filename};
+ test_helpers::Opts opts = {"newsboat", "-vc", filename};
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.cache_file() == filename);
@@ -267,7 +267,7 @@ TEST_CASE("Supports combined short option and value", "[CliArgsParser]")
{
const std::string filename("cache.db");
- TestHelpers::Opts opts = {"newsboat", "-c" + filename};
+ test_helpers::Opts opts = {"newsboat", "-c" + filename};
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.cache_file() == filename);
@@ -280,7 +280,7 @@ TEST_CASE("Supports `=` between short option and value",
{
const std::string filename("cache.db");
- TestHelpers::Opts opts = {"newsboat", "-c=" + filename};
+ test_helpers::Opts opts = {"newsboat", "-c=" + filename};
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.cache_file() == filename);
@@ -290,15 +290,15 @@ TEST_CASE("Supports `=` between short option and value",
TEST_CASE("Resolves tilde to homedir in -c/--cache-file", "[CliArgsParser]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
const std::string filename("mycache.db");
const std::string arg = std::string("~/") + filename;
- auto check = [&filename, &tmp](TestHelpers::Opts opts) {
+ auto check = [&filename, &tmp](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.cache_file() == tmp.get_path() + filename);
@@ -321,7 +321,7 @@ TEST_CASE(
{
const std::string filename("config file");
- auto check = [&filename](TestHelpers::Opts opts) {
+ auto check = [&filename](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.config_file() == filename);
@@ -339,15 +339,15 @@ TEST_CASE(
TEST_CASE("Resolves tilde to homedir in -C/--config-file", "[CliArgsParser]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
const std::string filename("newsboat-config");
const std::string arg = std::string("~/") + filename;
- auto check = [&filename, &tmp](TestHelpers::Opts opts) {
+ auto check = [&filename, &tmp](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.config_file() == tmp.get_path() + filename);
@@ -365,7 +365,7 @@ TEST_CASE("Resolves tilde to homedir in -C/--config-file", "[CliArgsParser]")
TEST_CASE("Sets `do_vacuum` if -X/--vacuum is provided", "[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.do_vacuum());
@@ -382,7 +382,7 @@ TEST_CASE("Sets `do_vacuum` if -X/--vacuum is provided", "[CliArgsParser]")
TEST_CASE("Sets `do_cleanup` if --cleanup is provided", "[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.do_cleanup());
@@ -396,7 +396,7 @@ TEST_CASE("Sets `do_cleanup` if --cleanup is provided", "[CliArgsParser]")
TEST_CASE("Increases `show_version` with each -v/-V/--version provided",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts, unsigned int expected_version) {
+ auto check = [](test_helpers::Opts opts, unsigned int expected_version) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.show_version() == expected_version);
@@ -433,7 +433,7 @@ TEST_CASE("Increases `show_version` with each -v/-V/--version provided",
TEST_CASE("Requests silent mode if -x/--execute is provided", "[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.silent());
@@ -450,7 +450,7 @@ TEST_CASE("Requests silent mode if -x/--execute is provided", "[CliArgsParser]")
TEST_CASE("Sets `execute_cmds` if -x/--execute is provided", "[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE_FALSE(args.cmds_to_execute().empty());
@@ -468,7 +468,7 @@ TEST_CASE("Sets `execute_cmds` if -x/--execute is provided", "[CliArgsParser]")
TEST_CASE("Inserts commands to cmds_to_execute if -x/--execute is provided",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts, const std::vector<std::string>& cmds) {
+ auto check = [](test_helpers::Opts opts, const std::vector<std::string>& cmds) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.cmds_to_execute() == cmds);
@@ -500,7 +500,7 @@ TEST_CASE("Inserts commands to cmds_to_execute if -x/--execute is provided",
TEST_CASE("Requests silent mode if -q/--quiet is provided", "[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.silent());
@@ -521,7 +521,7 @@ TEST_CASE(
{
const std::string filename("filename");
- auto check = [&filename](TestHelpers::Opts opts) {
+ auto check = [&filename](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.readinfo_import_file() == filename);
@@ -539,15 +539,15 @@ TEST_CASE(
TEST_CASE("Resolves tilde to homedir in -I/--import-from-file",
"[CliArgsParser]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
const std::string filename("read.txt");
const std::string arg = std::string("~/") + filename;
- auto check = [&filename, &tmp](TestHelpers::Opts opts) {
+ auto check = [&filename, &tmp](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.readinfo_import_file() == tmp.get_path() + filename);
@@ -568,7 +568,7 @@ TEST_CASE(
{
const std::string filename("filename");
- auto check = [&filename](TestHelpers::Opts opts) {
+ auto check = [&filename](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.readinfo_export_file() == filename);
@@ -585,15 +585,15 @@ TEST_CASE(
TEST_CASE("Resolves tilde to homedir in -E/--export-to-file", "[CliArgsParser]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
const std::string filename("read.txt");
const std::string arg = std::string("~/") + filename;
- auto check = [&filename, &tmp](TestHelpers::Opts opts) {
+ auto check = [&filename, &tmp](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.readinfo_export_file() == tmp.get_path() + filename);
@@ -616,7 +616,7 @@ TEST_CASE(
const std::string importf("import.opml");
const std::string exportf("export.opml");
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.should_print_usage());
@@ -637,7 +637,7 @@ TEST_CASE("Sets `log_file` if -d/--log-file is provided",
{
const std::string filename("log file.txt");
- auto check = [&filename](TestHelpers::Opts opts) {
+ auto check = [&filename](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.log_file() == filename);
@@ -654,15 +654,15 @@ TEST_CASE("Sets `log_file` if -d/--log-file is provided",
TEST_CASE("Resolves tilde to homedir in -d/--log-file", "[CliArgsParser]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
const std::string filename("newsboat.log");
const std::string arg = std::string("~/") + filename;
- auto check = [&filename, &tmp](TestHelpers::Opts opts) {
+ auto check = [&filename, &tmp](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.log_file() == tmp.get_path() + filename);
@@ -681,7 +681,7 @@ TEST_CASE(
"Sets `log_level` if argument to -l/--log-level is in range of [1; 6]",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts, Level expected) {
+ auto check = [](test_helpers::Opts opts, Level expected) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.log_level() == expected);
@@ -717,7 +717,7 @@ TEST_CASE(
"-l/--log-level is outside of [1; 6]",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts) {
+ auto check = [](test_helpers::Opts opts) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE_FALSE(args.display_msg() == "");
@@ -740,7 +740,7 @@ TEST_CASE(
TEST_CASE("Sets `program_name` to the first string of the options list",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts, std::string expected) {
+ auto check = [](test_helpers::Opts opts, std::string expected) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.program_name() == expected);
@@ -757,7 +757,7 @@ TEST_CASE("Sets `program_name` to the first string of the options list",
TEST_CASE("Test should fail on equal sign with multiple values",
"[CliArgsParser]")
{
- auto check = [](TestHelpers::Opts opts, const std::vector<std::string>& cmds) {
+ auto check = [](test_helpers::Opts opts, const std::vector<std::string>& cmds) {
CliArgsParser args(opts.argc(), opts.argv());
REQUIRE(args.should_print_usage());
REQUIRE(args.cmds_to_execute() != cmds);
@@ -771,8 +771,8 @@ TEST_CASE("Test should fail on equal sign with multiple values",
TEST_CASE("Supports combined short options where last has equal sign",
"[CliArgsParser]")
{
- TestHelpers::Opts opts = {"newsboat", "-rx=reload"};
+ test_helpers::Opts opts = {"newsboat", "-rx=reload"};
CliArgsParser args(opts.argc(), opts.argv());
std::vector<std::string> commands{"reload"};
REQUIRE(args.cmds_to_execute() == commands);
-} \ No newline at end of file
+}
diff --git a/test/configparser.cpp b/test/configparser.cpp
index c9b37afa..402df70d 100644
--- a/test/configparser.cpp
+++ b/test/configparser.cpp
@@ -274,8 +274,8 @@ TEST_CASE("`include` directive includes other config files", "[ConfigParser]")
REQUIRE_NOTHROW(cfgparser.parse_file("data/diamond-of-death/A"));
}
SECTION("File including itself only gets evaluated once") {
- TestHelpers::TempFile testfile;
- TestHelpers::EnvVar tmpfile("TMPFILE"); // $TMPFILE used in conf file
+ test_helpers::TempFile testfile;
+ test_helpers::EnvVar tmpfile("TMPFILE"); // $TMPFILE used in conf file
tmpfile.set(testfile.get_path());
// recursive includes don't fail
diff --git a/test/configpaths.cpp b/test/configpaths.cpp
index d5122270..ffff1931 100644
--- a/test/configpaths.cpp
+++ b/test/configpaths.cpp
@@ -17,18 +17,18 @@ TEST_CASE("ConfigPaths returns paths to Newsboat dotdir if no Newsboat dirs "
"exist",
"[ConfigPaths]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
const auto newsboat_dir = tmp.get_path() + ".newsboat";
REQUIRE(0 == utils::mkdir_parents(newsboat_dir, 0700));
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
// ConfigPaths rely on these variables, so let's sanitize them to ensure
// that the tests aren't affected
- TestHelpers::EnvVar xdg_config("XDG_CONFIG_HOME");
+ test_helpers::EnvVar xdg_config("XDG_CONFIG_HOME");
xdg_config.unset();
- TestHelpers::EnvVar xdg_data("XDG_DATA_HOME");
+ test_helpers::EnvVar xdg_data("XDG_DATA_HOME");
xdg_data.unset();
ConfigPaths paths;
@@ -46,20 +46,20 @@ TEST_CASE("ConfigPaths returns paths to Newsboat XDG dirs if they exist and "
"the dotdir doesn't",
"[ConfigPaths]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
const auto config_dir = tmp.get_path() + ".config/newsboat";
REQUIRE(0 == utils::mkdir_parents(config_dir, 0700));
const auto data_dir = tmp.get_path() + ".local/share/newsboat";
REQUIRE(0 == utils::mkdir_parents(data_dir, 0700));
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
// ConfigPaths rely on these variables, so let's sanitize them to ensure
// that the tests aren't affected
- TestHelpers::EnvVar xdg_config("XDG_CONFIG_HOME");
+ test_helpers::EnvVar xdg_config("XDG_CONFIG_HOME");
xdg_config.unset();
- TestHelpers::EnvVar xdg_data("XDG_DATA_HOME");
+ test_helpers::EnvVar xdg_data("XDG_DATA_HOME");
xdg_data.unset();
const auto check = [&]() {
@@ -75,34 +75,34 @@ TEST_CASE("ConfigPaths returns paths to Newsboat XDG dirs if they exist and "
};
SECTION("XDG_CONFIG_HOME is set") {
- TestHelpers::EnvVar xdg_config("XDG_CONFIG_HOME");
+ test_helpers::EnvVar xdg_config("XDG_CONFIG_HOME");
xdg_config.set(tmp.get_path() + ".config");
SECTION("XDG_DATA_HOME is set") {
- TestHelpers::EnvVar xdg_data("XDG_DATA_HOME");
+ test_helpers::EnvVar xdg_data("XDG_DATA_HOME");
xdg_data.set(tmp.get_path() + ".local/share");
check();
}
SECTION("XDG_DATA_HOME is not set") {
- TestHelpers::EnvVar xdg_data("XDG_DATA_HOME");
+ test_helpers::EnvVar xdg_data("XDG_DATA_HOME");
xdg_data.unset();
check();
}
}
SECTION("XDG_CONFIG_HOME is not set") {
- TestHelpers::EnvVar xdg_config("XDG_CONFIG_HOME");
+ test_helpers::EnvVar xdg_config("XDG_CONFIG_HOME");
xdg_config.unset();
SECTION("XDG_DATA_HOME is set") {
- TestHelpers::EnvVar xdg_data("XDG_DATA_HOME");
+ test_helpers::EnvVar xdg_data("XDG_DATA_HOME");
xdg_data.set(tmp.get_path() + ".local/share");
check();
}
SECTION("XDG_DATA_HOME is not set") {
- TestHelpers::EnvVar xdg_data("XDG_DATA_HOME");
+ test_helpers::EnvVar xdg_data("XDG_DATA_HOME");
xdg_data.unset();
check();
}
@@ -115,18 +115,18 @@ TEST_CASE("ConfigPaths::process_args replaces paths with the ones supplied by "
{
// ConfigPaths rely on these variables, so let's sanitize them to ensure
// that the tests aren't affected
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.unset();
- TestHelpers::EnvVar xdg_config("XDG_CONFIG_HOME");
+ test_helpers::EnvVar xdg_config("XDG_CONFIG_HOME");
xdg_config.unset();
- TestHelpers::EnvVar xdg_data("XDG_DATA_HOME");
+ test_helpers::EnvVar xdg_data("XDG_DATA_HOME");
xdg_data.unset();
const auto url_file = std::string("my urls file");
const auto cache_file = std::string("/path/to/cache file.db");
const auto lock_file = cache_file + ".lock";
const auto config_file = std::string("this is a/config");
- TestHelpers::Opts opts({
+ test_helpers::Opts opts({
"newsboat",
"-u", url_file,
"-c", cache_file,
@@ -148,14 +148,14 @@ TEST_CASE("ConfigPaths::set_cache_file changes paths to cache and lock files",
const auto test_dir = std::string("some/dir/we/use/as/home");
const auto newsboat_dir = test_dir + "/.newsboat/";
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(test_dir);
// ConfigPaths rely on these variables, so let's sanitize them to ensure
// that the tests aren't affected
- TestHelpers::EnvVar xdg_config("XDG_CONFIG_HOME");
+ test_helpers::EnvVar xdg_config("XDG_CONFIG_HOME");
xdg_config.unset();
- TestHelpers::EnvVar xdg_data("XDG_DATA_HOME");
+ test_helpers::EnvVar xdg_data("XDG_DATA_HOME");
xdg_data.unset();
ConfigPaths paths;
@@ -173,30 +173,30 @@ TEST_CASE("ConfigPaths::set_cache_file changes paths to cache and lock files",
TEST_CASE("ConfigPaths::create_dirs() returns true if both config and data dirs "
"were successfully created or already existed", "[ConfigPaths]")
{
- TestHelpers::TempDir tmp;
+ test_helpers::TempDir tmp;
- TestHelpers::EnvVar home("HOME");
+ test_helpers::EnvVar home("HOME");
home.set(tmp.get_path());
INFO("Temporary directory (used as HOME): " << tmp.get_path());
// ConfigPaths rely on these variables, so let's sanitize them to ensure
// that the tests aren't affected
- TestHelpers::EnvVar xdg_config("XDG_CONFIG_HOME");
+ test_helpers::EnvVar xdg_config("XDG_CONFIG_HOME");
xdg_config.unset();
- TestHelpers::EnvVar xdg_data("XDG_DATA_HOME");
+ test_helpers::EnvVar xdg_data("XDG_DATA_HOME");
xdg_data.unset();
const auto require_exists = [&tmp](std::vector<std::string> dirs) {
ConfigPaths paths;
REQUIRE(paths.initialized());
- REQUIRE(TestHelpers::starts_with(tmp.get_path(), paths.url_file()));
- REQUIRE(TestHelpers::starts_with(tmp.get_path(), paths.config_file()));
- REQUIRE(TestHelpers::starts_with(tmp.get_path(), paths.cache_file()));
- REQUIRE(TestHelpers::starts_with(tmp.get_path(), paths.lock_file()));
- REQUIRE(TestHelpers::starts_with(tmp.get_path(), paths.queue_file()));
- REQUIRE(TestHelpers::starts_with(tmp.get_path(), paths.search_file()));
- REQUIRE(TestHelpers::starts_with(tmp.get_path(), paths.cmdline_file()));
+ REQUIRE(test_helpers::starts_with(tmp.get_path(), paths.url_file()));
+ REQUIRE(test_helpers::starts_with(tmp.get_path(), paths.config_file()));