aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-26 20:33:18 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-26 20:33:18 +0000
commit264ff74a1af6fb3a2466de40611e2c2c104e1fe7 (patch)
tree77df0ef5e92b3a137145ce92eb4713d3b7039b01
parentec2bf14570524b1ff09a340df9231b99ffc6082c (diff)
downloadpaludis-264ff74a1af6fb3a2466de40611e2c2c104e1fe7.tar.gz
paludis-264ff74a1af6fb3a2466de40611e2c2c104e1fe7.tar.xz
gtest more
-rw-r--r--paludis/repositories/e/Makefile.am4
-rw-r--r--paludis/repositories/e/aa_visitor_TEST.cc45
2 files changed, 23 insertions, 26 deletions
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index 74d1fbe..c0aa9c2 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -394,13 +394,15 @@ dep_parser_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
aa_visitor_TEST_SOURCES = aa_visitor_TEST.cc
aa_visitor_TEST_LDADD = \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/gtest_runner.o \
$(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
$(top_builddir)/test/libtest.a \
$(DYNAMIC_LD_LIBS)
aa_visitor_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+aa_visitor_TEST_LDFLAGS = @GTESTDEPS_LDFLAGS@ @GTESTDEPS_LIBS@
+
fetch_visitor_TEST_SOURCES = fetch_visitor_TEST.cc
fetch_visitor_TEST_LDADD = \
diff --git a/paludis/repositories/e/aa_visitor_TEST.cc b/paludis/repositories/e/aa_visitor_TEST.cc
index 9c29e19..fa5f09a 100644
--- a/paludis/repositories/e/aa_visitor_TEST.cc
+++ b/paludis/repositories/e/aa_visitor_TEST.cc
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2007 Mike Kelly
+ * Copyright (c) 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,40 +18,34 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "aa_visitor.hh"
-#include "dep_parser.hh"
+#include <paludis/repositories/e/aa_visitor.hh>
+#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/eapi.hh>
+
#include <paludis/util/join.hh>
#include <paludis/util/make_named_values.hh>
-#include <paludis/repositories/e/eapi.hh>
+
#include <paludis/environments/test/test_environment.hh>
+
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
-#include <test/test_runner.hh>
-#include <test/test_framework.hh>
-using namespace test;
+#include <gtest/gtest.h>
+
using namespace paludis;
using namespace paludis::erepository;
-namespace test_cases
+TEST(AAVisitor, Works)
{
- struct AAVisitorTest : TestCase
- {
- AAVisitorTest() : TestCase("aa visitor") { }
-
- void run()
- {
- TestEnvironment env;
- std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
- n::environment() = &env,
- n::name() = RepositoryName("repo"))));
- env.add_repository(1, repo);
- std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
-
- AAVisitor p1;
- parse_fetchable_uri("( a -> b c x? ( d e ) )", &env, *EAPIData::get_instance()->eapi_from_string("paludis-1"), false)->top()->accept(p1);
- TEST_CHECK_EQUAL(join(p1.begin(), p1.end(), " "), "b c d e");
- }
- } test_aa_visitor;
+ TestEnvironment env;
+ std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
+ n::environment() = &env,
+ n::name() = RepositoryName("repo"))));
+ env.add_repository(1, repo);
+ std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
+
+ AAVisitor p1;
+ parse_fetchable_uri("( a -> b c x? ( d e ) )", &env, *EAPIData::get_instance()->eapi_from_string("paludis-1"), false)->top()->accept(p1);
+ EXPECT_EQ("b c d e", join(p1.begin(), p1.end(), " "));
}