aboutsummaryrefslogtreecommitdiff
path: root/paludis/environments/paludis/world_TEST.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-17 10:12:54 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-17 10:34:54 +0100
commit1d7b030ddca58f5dd977d5429bab5034789c5a99 (patch)
tree398a06f3ec8676941dce7aef2b21f724cee6b59a /paludis/environments/paludis/world_TEST.cc
parent16d0f528e226e88b28286d8b52a49dbb41ad752b (diff)
downloadpaludis-1d7b030ddca58f5dd977d5429bab5034789c5a99.tar.gz
paludis-1d7b030ddca58f5dd977d5429bab5034789c5a99.tar.xz
Update PaludisEnvironment::world for package moves
Diffstat (limited to 'paludis/environments/paludis/world_TEST.cc')
-rw-r--r--paludis/environments/paludis/world_TEST.cc61
1 files changed, 61 insertions, 0 deletions
diff --git a/paludis/environments/paludis/world_TEST.cc b/paludis/environments/paludis/world_TEST.cc
new file mode 100644
index 000000000..3a4e10b03
--- /dev/null
+++ b/paludis/environments/paludis/world_TEST.cc
@@ -0,0 +1,61 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/environments/paludis/world.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/safe_ifstream.hh>
+#include <paludis/util/options.hh>
+#include <test/test_runner.hh>
+#include <test/test_framework.hh>
+#include <iterator>
+#include <cstdlib>
+
+using namespace paludis;
+using namespace test;
+
+namespace test_cases
+{
+ struct TestWorldUpdates : TestCase
+ {
+ TestWorldUpdates() : TestCase("world updates") { }
+
+ void run()
+ {
+ std::tr1::shared_ptr<FSEntry> w(new FSEntry(FSEntry::cwd() / "world_TEST_dir" / "world"));
+
+ {
+ TestEnvironment env;
+ paludis_environment::World world(&env, w);
+ world.update_config_files_for_package_move(make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
+ .package(QualifiedPackageName("cat/before")),
+ QualifiedPackageName("cat/after"));
+ }
+
+ SafeIFStream f(*w);
+ std::string ff((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
+ TEST_CHECK_EQUAL(ff,
+ "cat/unchanged\n"
+ "cat/alsounchanged\n"
+ "cat/after\n"
+ );
+ }
+ } world_updates_test;
+}
+