Commit | Line | Data |
---|---|---|
1479465f GJ |
1 | /* |
2 | * libdpkg - Debian packaging suite library routines | |
3 | * t-trigger.c - test triggers | |
4 | * | |
5 | * Copyright © 2012 Guillem Jover <guillem@debian.org> | |
6 | * | |
7 | * This is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | |
19 | */ | |
20 | ||
21 | #include <config.h> | |
22 | #include <compat.h> | |
23 | ||
24 | #include <dpkg/test.h> | |
25 | #include <dpkg/triglib.h> | |
26 | ||
27 | static void | |
28 | test_trig_name_is_illegal(void) | |
29 | { | |
30 | /* Test invalid trigger names. */ | |
31 | test_fail(trig_name_is_illegal("") == NULL); | |
32 | test_fail(trig_name_is_illegal("\a") == NULL); | |
33 | test_fail(trig_name_is_illegal("\t") == NULL); | |
34 | test_fail(trig_name_is_illegal("\200") == NULL); | |
35 | test_fail(trig_name_is_illegal("trigger name") == NULL); | |
36 | ||
37 | /* Test valid trigger names. */ | |
38 | test_pass(trig_name_is_illegal("TRIGGER") == NULL); | |
39 | test_pass(trig_name_is_illegal("trigger") == NULL); | |
40 | test_pass(trig_name_is_illegal("0123456789") == NULL); | |
41 | test_pass(trig_name_is_illegal("/file/trigger") == NULL); | |
42 | } | |
43 | ||
44 | TEST_ENTRY(test) | |
45 | { | |
46 | test_plan(9); | |
47 | ||
48 | test_trig_name_is_illegal(); | |
49 | } |