diff options
Diffstat (limited to 'paludis')
-rw-r--r-- | paludis/repositories/fake/Makefile.am | 34 | ||||
-rw-r--r-- | paludis/repositories/fake/dep_parser_TEST.cc | 29 | ||||
-rw-r--r-- | paludis/repositories/fake/fake_installed_repository_TEST.cc | 35 | ||||
-rw-r--r-- | paludis/repositories/fake/fake_repository_TEST.cc | 30 |
4 files changed, 57 insertions, 71 deletions
diff --git a/paludis/repositories/fake/Makefile.am b/paludis/repositories/fake/Makefile.am index c51b5ff0a..1b2e39348 100644 --- a/paludis/repositories/fake/Makefile.am +++ b/paludis/repositories/fake/Makefile.am @@ -14,35 +14,41 @@ EXTRA_DIST = \ fake_installed_repository_TEST.cc \ dep_parser_TEST.cc +fake_repository_TEST_SOURCES = \ + fake_repository_TEST.cc + fake_repository_TEST_LDADD = \ + $(top_builddir)/paludis/util/gtest_runner.o \ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a + $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la fake_repository_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ +fake_repository_TEST_LDFLAGS = @GTESTDEPS_LDFLAGS@ @GTESTDEPS_LIBS@ + +fake_installed_repository_TEST_SOURCES = \ + fake_installed_repository_TEST.cc + fake_installed_repository_TEST_LDADD = \ + $(top_builddir)/paludis/util/gtest_runner.o \ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a + $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la fake_installed_repository_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ +fake_installed_repository_TEST_LDFLAGS = @GTESTDEPS_LDFLAGS@ @GTESTDEPS_LIBS@ + +dep_parser_TEST_SOURCES = \ + dep_parser_TEST.cc + dep_parser_TEST_LDADD = \ + $(top_builddir)/paludis/util/gtest_runner.o \ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a + $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la dep_parser_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ -fake_repository_TEST_SOURCES = \ - fake_repository_TEST.cc - -fake_installed_repository_TEST_SOURCES = \ - fake_installed_repository_TEST.cc - -dep_parser_TEST_SOURCES = \ - dep_parser_TEST.cc +dep_parser_TEST_LDFLAGS = @GTESTDEPS_LDFLAGS@ @GTESTDEPS_LIBS@ noinst_LTLIBRARIES = libpaludisfakerepository.la diff --git a/paludis/repositories/fake/dep_parser_TEST.cc b/paludis/repositories/fake/dep_parser_TEST.cc index 2d216df53..08b34163e 100644 --- a/paludis/repositories/fake/dep_parser_TEST.cc +++ b/paludis/repositories/fake/dep_parser_TEST.cc @@ -18,16 +18,19 @@ */ #include <paludis/repositories/fake/dep_parser.hh> + #include <paludis/environments/test/test_environment.hh> + #include <paludis/util/indirect_iterator-impl.hh> #include <paludis/util/accept_visitor.hh> -#include <test/test_runner.hh> -#include <test/test_framework.hh> +#include <paludis/util/stringify.hh> + #include <sstream> #include <algorithm> +#include <gtest/gtest.h> + using namespace paludis; -using namespace test; namespace { @@ -78,21 +81,13 @@ namespace }; } -namespace test_cases +TEST(DepParser, Works) { - struct DepParserTest : TestCase - { - DepParserTest() : TestCase("dep parser") { } - - void run() - { - TestEnvironment env; - std::shared_ptr<DependencySpecTree> d(fakerepository::parse_depend("( ( a/a b/b ) )", &env)); + TestEnvironment env; + std::shared_ptr<DependencySpecTree> d(fakerepository::parse_depend("( ( a/a b/b ) )", &env)); - QuickPrinter p; - d->top()->accept(p); - TEST_CHECK_EQUAL(p.str.str(), "all<all<all<p<a/a>p<b/b>>>>"); - } - } dep_parser_test; + QuickPrinter p; + d->top()->accept(p); + EXPECT_EQ("all<all<all<p<a/a>p<b/b>>>>", p.str.str()); } diff --git a/paludis/repositories/fake/fake_installed_repository_TEST.cc b/paludis/repositories/fake/fake_installed_repository_TEST.cc index fc3d6bf73..da7862495 100644 --- a/paludis/repositories/fake/fake_installed_repository_TEST.cc +++ b/paludis/repositories/fake/fake_installed_repository_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 2008, 2009, 2010, 2011 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 @@ -17,32 +17,25 @@ * Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <test/test_runner.hh> -#include <test/test_framework.hh> #include <paludis/repositories/fake/fake_installed_repository.hh> + #include <paludis/environments/test/test_environment.hh> + #include <paludis/util/make_named_values.hh> -using namespace test; +#include <gtest/gtest.h> + using namespace paludis; -namespace test_cases +TEST(FakeInstalledRepository, Works) { - struct FakeInstalledRepositoryTest : TestCase - { - FakeInstalledRepositoryTest() : TestCase("fake installed repository") { } - - void run() - { - TestEnvironment env; - std::shared_ptr<const FakeInstalledRepository> r(std::make_shared<FakeInstalledRepository>( - make_named_values<FakeInstalledRepositoryParams>( - n::environment() = &env, - n::name() = RepositoryName("fake"), - n::suitable_destination() = true, - n::supports_uninstall() = true - ))); - } - } test_fake_installed_repository; + TestEnvironment env; + std::shared_ptr<const FakeInstalledRepository> r(std::make_shared<FakeInstalledRepository>( + make_named_values<FakeInstalledRepositoryParams>( + n::environment() = &env, + n::name() = RepositoryName("fake"), + n::suitable_destination() = true, + n::supports_uninstall() = true + ))); } diff --git a/paludis/repositories/fake/fake_repository_TEST.cc b/paludis/repositories/fake/fake_repository_TEST.cc index 007b977cc..0a12a70b0 100644 --- a/paludis/repositories/fake/fake_repository_TEST.cc +++ b/paludis/repositories/fake/fake_repository_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 2008, 2009, 2010, 2011 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 @@ -17,30 +17,22 @@ * Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <test/test_runner.hh> -#include <test/test_framework.hh> #include <paludis/repositories/fake/fake_repository.hh> + #include <paludis/environments/test/test_environment.hh> + #include <paludis/util/make_named_values.hh> -using namespace test; +#include <gtest/gtest.h> + using namespace paludis; -namespace test_cases +TEST(FakeRepository, Works) { - struct FakeRepositoryTest : TestCase - { - FakeRepositoryTest() : TestCase("fake repository") { } - - void run() - { - TestEnvironment env; - const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>( - n::environment() = &env, - n::name() = RepositoryName("repo") - ))); - } - } test_fake_repository; + TestEnvironment env; + const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>( + n::environment() = &env, + n::name() = RepositoryName("repo") + ))); } - |