gtest more

This commit is contained in:
Ciaran McCreesh 2011-03-26 20:33:18 +00:00
parent ec2bf14570
commit 264ff74a1a
2 changed files with 22 additions and 25 deletions

@ -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 = \

@ -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") { }
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"));
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;
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(), " "));
}