diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-11-02 23:14:04 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-11-04 11:46:03 +0100 |
| commit | e1555a8837da05f135a3705112469206fc17ec80 (patch) | |
| tree | 591de2b5330e351b733a7f5488f35c35aeae2f2b /test/config_test.cc | |
| parent | 89c0fc8bf6893ecde5e220dca96444afd069bf7f (diff) | |
Add ConfigRestorer and use it instead of setup_test_config() directly.
Diffstat (limited to 'test/config_test.cc')
| -rw-r--r-- | test/config_test.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/test/config_test.cc b/test/config_test.cc index 035d77828..48dec27d7 100644 --- a/test/config_test.cc +++ b/test/config_test.cc @@ -47,6 +47,8 @@ rewrite_bad_config () BOOST_AUTO_TEST_CASE (config_backup_test) { + ConfigRestorer cr; + Config::override_path = "build/test/bad_config"; Config::drop(); @@ -88,16 +90,13 @@ BOOST_AUTO_TEST_CASE (config_backup_test) BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.2")); BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.3")); BOOST_CHECK (boost::filesystem::exists("build/test/bad_config/2.16/config.xml.4")); - - /* This test has called Config::set_defaults(), so take us back - to the config that we want for our tests. - */ - setup_test_config (); } BOOST_AUTO_TEST_CASE (config_write_utf8_test) { + ConfigRestorer cr; + boost::filesystem::remove_all ("build/test/config.xml"); boost::filesystem::copy_file ("test/data/utf8_config.xml", "build/test/config.xml"); Config::override_path = "build/test"; @@ -105,16 +104,13 @@ BOOST_AUTO_TEST_CASE (config_write_utf8_test) Config::instance()->write(); check_text_file ("test/data/utf8_config.xml", "build/test/config.xml"); - - /* This test has called Config::set_defaults(), so take us back - to the config that we want for our tests. - */ - setup_test_config (); } BOOST_AUTO_TEST_CASE (config_upgrade_test) { + ConfigRestorer cr; + boost::filesystem::path dir = "build/test/config_upgrade_test"; Config::override_path = dir; Config::drop (); @@ -139,7 +135,5 @@ BOOST_AUTO_TEST_CASE (config_upgrade_test) #endif /* cinemas.xml is not copied into 2.16 as its format has not changed */ BOOST_REQUIRE (!boost::filesystem::exists(dir / "2.16" / "cinemas.xml")); - - setup_test_config(); } |
