aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-28 19:46:34 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-28 19:46:34 +0000
commitf42742f10cf8efbf1fe594050003b0ccbf006038 (patch)
treed19f0e0823df446e3e5243f54b83fd55ce84d59f
parent55f4099b031d4d0a427eeb5a3823dabbe5bbabf8 (diff)
downloadpaludis-f42742f10cf8efbf1fe594050003b0ccbf006038.tar.gz
paludis-f42742f10cf8efbf1fe594050003b0ccbf006038.tar.xz
Fix dep parser.
-rw-r--r--paludis/repositories/unpackaged/Makefile.am18
-rw-r--r--paludis/repositories/unpackaged/dep_parser.cc2
-rw-r--r--paludis/repositories/unpackaged/dep_parser.hh2
-rw-r--r--paludis/repositories/unpackaged/dep_parser_TEST.cc48
-rw-r--r--paludis/repositories/unpackaged/dep_printer.hh2
5 files changed, 67 insertions, 5 deletions
diff --git a/paludis/repositories/unpackaged/Makefile.am b/paludis/repositories/unpackaged/Makefile.am
index d1ac224..4ea7844 100644
--- a/paludis/repositories/unpackaged/Makefile.am
+++ b/paludis/repositories/unpackaged/Makefile.am
@@ -83,6 +83,17 @@ installed_repository_TEST_LDADD = \
$(top_builddir)/test/libtest.a \
$(DYNAMIC_LD_LIBS)
+dep_parser_TEST_SOURCES = dep_parser_TEST.cc
+
+dep_parser_TEST_LDADD = \
+ libpaludisunpackagedrepository.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
EXTRA_DIST = \
ndbam.sr \
ndbam-sr.hh \
@@ -105,7 +116,8 @@ EXTRA_DIST = \
installed_repository.sr \
installed_repository-sr.hh \
installed_repository-sr.cc \
- installed_id.cc
+ installed_id.cc \
+ dep_parser_TEST.cc
BUILT_SOURCES = \
ndbam-sr.hh ndbam-sr.cc \
@@ -136,7 +148,8 @@ TESTS_ENVIRONMENT = env \
TESTS = \
unpackaged_repository_TEST \
- installed_repository_TEST
+ installed_repository_TEST \
+ dep_parser_TEST
check_PROGRAMS = $(TESTS)
@@ -180,3 +193,4 @@ distcheck-deps : distcheck-deps-subdirs
distcheck-deps-subdirs :
for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
+
diff --git a/paludis/repositories/unpackaged/dep_parser.cc b/paludis/repositories/unpackaged/dep_parser.cc
index 8416d29..fda6576 100644
--- a/paludis/repositories/unpackaged/dep_parser.cc
+++ b/paludis/repositories/unpackaged/dep_parser.cc
@@ -36,7 +36,7 @@ DepParser::parse(const std::string & s)
new ConstTreeSequence<DependencySpecTree, AllDepSpec>(tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
std::list<std::string> tokens;
- tokenise<delim_kind::AnyOfTag, delim_mode::BoundaryTag>(s, ",", "", std::back_inserter(tokens));
+ tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(s, ",", "", std::back_inserter(tokens));
for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
t != t_end ; ++t)
diff --git a/paludis/repositories/unpackaged/dep_parser.hh b/paludis/repositories/unpackaged/dep_parser.hh
index 3959301..391f127 100644
--- a/paludis/repositories/unpackaged/dep_parser.hh
+++ b/paludis/repositories/unpackaged/dep_parser.hh
@@ -27,7 +27,7 @@ namespace paludis
{
namespace unpackaged_repositories
{
- class DepParser :
+ class PALUDIS_VISIBLE DepParser :
private InstantiationPolicy<DepParser, instantiation_method::NonInstantiableTag>
{
public:
diff --git a/paludis/repositories/unpackaged/dep_parser_TEST.cc b/paludis/repositories/unpackaged/dep_parser_TEST.cc
new file mode 100644
index 0000000..48921e5
--- /dev/null
+++ b/paludis/repositories/unpackaged/dep_parser_TEST.cc
@@ -0,0 +1,48 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 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/repositories/unpackaged/dep_parser.hh>
+#include <paludis/repositories/unpackaged/dep_printer.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/stringify_formatter.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::unpackaged_repositories;
+using namespace test;
+
+namespace test_cases
+{
+ struct DepParserTest : TestCase
+ {
+ DepParserTest() : TestCase("dep parser") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ tr1::shared_ptr<const DependencySpecTree::ConstItem> spec(DepParser::parse("cat/one , cat/two, cat/three\n"));
+ StringifyFormatter f;
+ DepPrinter p(&env, f, true);
+ spec->accept(p);
+ TEST_CHECK_EQUAL(p.result(), "cat/one, cat/two, cat/three");
+ }
+ } test_dep_parser;
+}
+
diff --git a/paludis/repositories/unpackaged/dep_printer.hh b/paludis/repositories/unpackaged/dep_printer.hh
index a60626e..f8a75b8 100644
--- a/paludis/repositories/unpackaged/dep_printer.hh
+++ b/paludis/repositories/unpackaged/dep_printer.hh
@@ -30,7 +30,7 @@ namespace paludis
{
namespace unpackaged_repositories
{
- class DepPrinter :
+ class PALUDIS_VISIBLE DepPrinter :
public ConstVisitor<DependencySpecTree>,
public ConstVisitor<DependencySpecTree>::VisitConstSequence<DepPrinter, AllDepSpec>,
public ConstVisitor<DependencySpecTree>::VisitConstSequence<DepPrinter, AnyDepSpec>,