aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-25 11:02:04 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-25 16:55:34 +0000
commit696a370f93de32f8fbb115c84733595e96ede8b4 (patch)
tree829346d77b6985afb6ae7390bfe35f8f2ce87df0
parentc225b90e67f8bc211cb738558f6d57427089e3f6 (diff)
downloadpaludis-696a370f93de32f8fbb115c84733595e96ede8b4.tar.gz
paludis-696a370f93de32f8fbb115c84733595e96ede8b4.tar.xz
gtest more
-rw-r--r--paludis/repositories/fake/Makefile.am34
-rw-r--r--paludis/repositories/fake/dep_parser_TEST.cc29
-rw-r--r--paludis/repositories/fake/fake_installed_repository_TEST.cc35
-rw-r--r--paludis/repositories/fake/fake_repository_TEST.cc30
4 files changed, 57 insertions, 71 deletions
diff --git a/paludis/repositories/fake/Makefile.am b/paludis/repositories/fake/Makefile.am
index c51b5ff..1b2e393 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 2d216df..08b3416 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 fc3d6bf..da78624 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 007b977..0a12a70 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")
+ )));
}
-