- /* This test has called Config::set_defaults(), so take us back
- to the config that we want for our tests.
- */
- setup_test_config ();
+ ConfigRestorer cr;
+
+ auto base = path("build/test/bad_config");
+ auto version = base / "2.16";
+
+ Config::override_path = base;
+ Config::drop();
+
+ boost::filesystem::remove_all (base);
+
+ boost::filesystem::create_directories (version);
+ std::ofstream f (path(version / "config.xml").string().c_str());
+ f << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ << "<Config>\n"
+ << "<Link>" << path(version / "actual.xml").string() << "</Link>\n"
+ << "</Config>\n";
+ f.close ();
+
+ Config::drop ();
+ /* Cause actual.xml to be backed up */
+ rewrite_bad_config ("actual.xml", "first write");
+ Config::instance ();
+
+ /* Make sure actual.xml was backed up to the right place */
+ BOOST_CHECK (boost::filesystem::exists(version / "actual.xml.1"));