aboutsummaryrefslogtreecommitdiff
path: root/paludis/name_TEST.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/name_TEST.cc')
-rw-r--r--paludis/name_TEST.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/paludis/name_TEST.cc b/paludis/name_TEST.cc
index 4de4856c0..cbd0c97a7 100644
--- a/paludis/name_TEST.cc
+++ b/paludis/name_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008 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
@@ -343,7 +343,27 @@ namespace test_cases
}
} test_keyword_name_validation;
+ struct SetNameValidationTest : public TestCase
+ {
+ SetNameValidationTest() : TestCase("validation") { }
-
+ void run()
+ {
+ SetName k("set0_-");
+ SetName k1("set0_-");
+ SetName k2("set0*");
+ TEST_CHECK_THROWS(k = SetName(""), NameError);
+ TEST_CHECK_THROWS(k = SetName("!!!"), NameError);
+ TEST_CHECK_THROWS(k = SetName("~"), NameError);
+ TEST_CHECK_THROWS(k = SetName("-"), NameError);
+ TEST_CHECK_THROWS(k = SetName("f?oo"), NameError);
+ TEST_CHECK_THROWS(k = SetName("*"), NameError);
+ TEST_CHECK_THROWS(k = SetName("?"), NameError);
+ TEST_CHECK_THROWS(k = SetName("*set"), NameError);
+ TEST_CHECK_THROWS(k = SetName("set**"), NameError);
+ TEST_CHECK_THROWS(k = SetName("set*?"), NameError);
+ TEST_CHECK_THROWS(k = SetName("set?"), NameError);
+ }
+ } test_set_name_validator;
}