diff options
author | 2006-01-23 05:51:15 +0000 | |
---|---|---|
committer | 2006-01-23 05:51:15 +0000 | |
commit | 7a9ebb1c70316be30c2a69afa22f8bf5e82112db (patch) | |
tree | b240d260043b9e02c9ebaaf978a89db2ef24052a | |
parent | 6bce4b1f94124611e934117fd29bbfe0c1923beb (diff) | |
download | paludis-7a9ebb1c70316be30c2a69afa22f8bf5e82112db.tar.gz paludis-7a9ebb1c70316be30c2a69afa22f8bf5e82112db.tar.xz |
Add some testcases for CategoryNamePart
-rw-r--r-- | paludis/category_name_part_TEST.cc | 71 | ||||
-rw-r--r-- | paludis/files.m4 | 2 |
2 files changed, 72 insertions, 1 deletions
diff --git a/paludis/category_name_part_TEST.cc b/paludis/category_name_part_TEST.cc new file mode 100644 index 000000000..8adeaa906 --- /dev/null +++ b/paludis/category_name_part_TEST.cc @@ -0,0 +1,71 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 2006 Mark Loeser <halcy0n@gentoo.org> + * + * 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 "category_name_part.hh" +#include <test/test_framework.hh> +#include <test/test_runner.hh> +#include <string> + +using namespace test; +using namespace paludis; + +/** \file + * Test cases for category_name_part.hh . + * + * \ingroup Test + */ + +namespace test_cases +{ + /** + * \test Test CategoryNamePart creation. + * + * \ingroup Test + */ + struct CategoryNamePartCreationTest : public TestCase + { + CategoryNamePartCreationTest() : TestCase("creation") { } + + void run() + { + CategoryNamePart p("foo"); + TEST_CHECK(true); + } + } category_package_name_part_creation; + + /** + * \test Test CategoryNamePart validation + * + * \ingroup Test + */ + struct CategoryNamePartValidationTest : public TestCase + { + CategoryNamePartValidationTest() : TestCase("validation") {} + + void run() + { + CategoryNamePart p = CategoryNamePart("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-+_"); + + TEST_CHECK_THROWS(p = CategoryNamePart(""), CategoryNamePartError); + TEST_CHECK_THROWS(p = CategoryNamePart("*"), CategoryNamePartError); + TEST_CHECK_THROWS(p = CategoryNamePart("foo bar"), CategoryNamePartError); + } + } category_package_name_part_validation; +} + diff --git a/paludis/files.m4 b/paludis/files.m4 index ea6a80394..f9a11bb98 100644 --- a/paludis/files.m4 +++ b/paludis/files.m4 @@ -13,7 +13,7 @@ add(`all_dep_atom', `hh', `cc') add(`any_dep_atom', `hh', `cc') add(`attributes', `hh', `cc') add(`block_dep_atom', `hh', `cc') -add(`category_name_part', `hh', `cc') +add(`category_name_part', `hh', `cc', `test') add(`comparison_policy', `hh', `cc', `test') add(`composite_dep_atom', `hh', `cc') add(`composite_pattern', `hh', `cc') |