From 18869c2c7505d5fe80b38351be8b0edf74f9ed6e Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Mon, 11 Oct 2021 00:02:33 +0100 Subject: [PATCH] Add some extra tests The behaviour here is unchanged, but was previously untested. --- apps/openmw_test_suite/openmw/options.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/openmw_test_suite/openmw/options.cpp b/apps/openmw_test_suite/openmw/options.cpp index 0f9ad39053..b087fd03fb 100644 --- a/apps/openmw_test_suite/openmw/options.cpp +++ b/apps/openmw_test_suite/openmw/options.cpp @@ -272,6 +272,24 @@ namespace EXPECT_EQ(variables["load-savegame"].as().string(), ""); } + TEST(OpenMWOptionsFromConfig, should_ignore_whitespace_prefixed_commented_option) + { + bpo::options_description description = makeOptionsDescription(); + std::istringstream stream(" \t#load-savegame=save.omwsave"); + bpo::variables_map variables; + Files::parseConfig(stream, variables, description); + EXPECT_EQ(variables["load-savegame"].as().string(), ""); + } + + TEST(OpenMWOptionsFromConfig, should_support_whitespace_around_option) + { + bpo::options_description description = makeOptionsDescription(); + std::istringstream stream(" load-savegame = save.omwsave "); + bpo::variables_map variables; + Files::parseConfig(stream, variables, description); + EXPECT_EQ(variables["load-savegame"].as().string(), "save.omwsave"); + } + TEST(OpenMWOptionsFromConfig, should_throw_on_multiple_load_savegame) { bpo::options_description description = makeOptionsDescription();