|
grim@400
|
1 |
/* |
|
grim@400
|
2 |
* Copyright (C) 2007-2010 Gary Kramlich <grim@reaperworld.com> |
|
grim@400
|
3 |
* |
|
grim@400
|
4 |
* This program is free software: you can redistribute it and/or modify |
|
grim@400
|
5 |
* it under the terms of the GNU General Public License as published by |
|
grim@400
|
6 |
* the Free Software Foundation, either version 3 of the License, or |
|
grim@400
|
7 |
* (at your option) any later version. |
|
grim@400
|
8 |
* |
|
grim@400
|
9 |
* This program is distributed in the hope that it will be useful, |
|
grim@400
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
grim@400
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
grim@400
|
12 |
* GNU General Public License for more details. |
|
grim@400
|
13 |
* |
|
grim@400
|
14 |
* You should have received a copy of the GNU General Public License |
|
grim@400
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
grim@400
|
16 |
*/ |
|
grim@396
|
17 |
#include <gplate/gplate.h> |
|
grim@396
|
18 |
|
|
grim@396
|
19 |
#include <glib.h> |
|
grim@396
|
20 |
|
|
grim@400
|
21 |
#include "test-gplate-tag.h" |
|
grim@396
|
22 |
|
|
grim@396
|
23 |
/****************************************************************************** |
|
grim@396
|
24 |
* Tests |
|
grim@396
|
25 |
*****************************************************************************/ |
|
grim@396
|
26 |
static void |
|
grim@400
|
27 |
test_gplate_comment_tag_empty(TestGPlateTagFixture *fixture, |
|
grim@396
|
28 |
gconstpointer data) |
|
grim@396
|
29 |
{ |
|
grim@400
|
30 |
test_gplate_tag_output(fixture, data, "{##}", ""); |
|
grim@396
|
31 |
} |
|
grim@396
|
32 |
|
|
grim@396
|
33 |
static void |
|
grim@400
|
34 |
test_gplate_comment_tag_whitespace(TestGPlateTagFixture *fixture, |
|
grim@396
|
35 |
gconstpointer data) |
|
grim@396
|
36 |
{ |
|
grim@400
|
37 |
test_gplate_tag_output(fixture, data, "{# #}", ""); |
|
grim@400
|
38 |
test_gplate_tag_output(fixture, data, "{#\t#}", ""); |
|
grim@400
|
39 |
test_gplate_tag_output(fixture, data, "{#\n#}", ""); |
|
grim@400
|
40 |
test_gplate_tag_output(fixture, data, "{#\r#}", ""); |
|
grim@400
|
41 |
test_gplate_tag_output(fixture, data, "{#\r\n#}", ""); |
|
grim@400
|
42 |
test_gplate_tag_output(fixture, data, "{#\n\r#}", ""); |
|
grim@396
|
43 |
} |
|
grim@396
|
44 |
|
|
grim@396
|
45 |
static void |
|
grim@400
|
46 |
test_gplate_comment_tag_simple(TestGPlateTagFixture *fixture, |
|
grim@396
|
47 |
gconstpointer data) |
|
grim@396
|
48 |
{ |
|
grim@400
|
49 |
test_gplate_tag_output(fixture, data, "{# foo#}", ""); |
|
grim@400
|
50 |
test_gplate_tag_output(fixture, data, "{#foo #}", ""); |
|
grim@400
|
51 |
test_gplate_tag_output(fixture, data, "{#\tfoo#}", ""); |
|
grim@400
|
52 |
test_gplate_tag_output(fixture, data, "{#foo\t#}", ""); |
|
grim@400
|
53 |
test_gplate_tag_output(fixture, data, "{#\nfoo#}", ""); |
|
grim@400
|
54 |
test_gplate_tag_output(fixture, data, "{#foo\n#}", ""); |
|
grim@400
|
55 |
test_gplate_tag_output(fixture, data, "{#\rfoo#}", ""); |
|
grim@400
|
56 |
test_gplate_tag_output(fixture, data, "{#foo\r#}", ""); |
|
grim@400
|
57 |
test_gplate_tag_output(fixture, data, "{#\r\nfoo#}", ""); |
|
grim@400
|
58 |
test_gplate_tag_output(fixture, data, "{#foo\r\n#}", ""); |
|
grim@396
|
59 |
} |
|
grim@396
|
60 |
|
|
grim@396
|
61 |
/****************************************************************************** |
|
grim@396
|
62 |
* Main |
|
grim@396
|
63 |
*****************************************************************************/ |
|
grim@396
|
64 |
gint |
|
grim@396
|
65 |
main(gint argc, gchar **argv) { |
|
grim@396
|
66 |
g_test_init(&argc, &argv, NULL); |
|
grim@396
|
67 |
|
|
grim@396
|
68 |
g_type_init(); |
|
grim@396
|
69 |
|
|
grim@396
|
70 |
gplate_config_load_default(); |
|
grim@396
|
71 |
|
|
grim@400
|
72 |
test_gplate_tag_add("/tags/comment/empty", |
|
grim@400
|
73 |
test_gplate_comment_tag_empty); |
|
grim@400
|
74 |
test_gplate_tag_add("/tags/comment/whitespace", |
|
grim@400
|
75 |
test_gplate_comment_tag_whitespace); |
|
grim@400
|
76 |
test_gplate_tag_add("/tags/comment/simple", |
|
grim@400
|
77 |
test_gplate_comment_tag_simple); |
|
grim@396
|
78 |
|
|
grim@396
|
79 |
return g_test_run(); |
|
grim@396
|
80 |
} |
|
grim@396
|
81 |
|