-
Notifications
You must be signed in to change notification settings - Fork 22
/
CMakeLists.txt
128 lines (100 loc) · 5.43 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#
# Copyright (c) 2011-2018 EditorConfig Team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Basic parser tests
# test repeat sections
new_ec_test_multiline(repeat_sections_ML basic.in a.a "option1=value1[ \t]*[\n\r]+option2=value2[ \t\n\r]*")
new_ec_test_multiline(basic_cascade_ML basic.in b.b "option1=c[ \t]*[\n\r]+option2=b[ \t\n\r]*")
# Tests for whitespace parsing
# test no whitespaces in property assignment
new_ec_test(no_whitespace whitespace.in test1.c "^key=value[ \t\n\r]*$")
# test single spaces around equals sign
new_ec_test(single_spaces_around_equals whitespace.in test2.c
"^key=value[ \t\n\r]*$")
# test multiple spaces around equals sign
new_ec_test(multiple_spaces_around_equals whitespace.in test3.c
"^key=value[ \t\n\r]*$")
# test spaces before property name
new_ec_test(spaces_before_property_name whitespace.in test4.c
"^key=value[ \t\n\r]*$")
# test spaces before after property value
new_ec_test(spaces_after_property_value whitespace.in test5.c
"^key=value[ \t\n\r]*$")
# test blank lines between properties
new_ec_test_multiline(blank_lines_between_properties_ML whitespace.in test6.c
"key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*")
# test spaces in section name
new_ec_test(spaces_in_section_name whitespace.in " test 7 "
"^key=value[ \t\n\r]*$")
# test spaces before section name are ignored
new_ec_test(spaces_before_section_name whitespace.in test8.c
"^key=value[ \t\n\r]*$")
# test spaces after section name
new_ec_test(spaces_after_section_name whitespace.in test9.c "^key=value[ \t\n\r]*$")
# test spaces at beginning of line between properties
new_ec_test_multiline(spaces_before_middle_property_ML whitespace.in test10.c
"key1=value1[ \t]*[\n\r]+key2=value2[ \t]*[\n\r]+key3=value3[ \t\n\r]*")
# Tests for comment parsing
# test comments ignored before properties
new_ec_test(comment_before_props comments.in test3.c
"^key=value[ \t\n\r]*$")
# test comments ignored between properties
new_ec_test_multiline(comment_between_props_ML comments.in test4.c
"key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*")
# test semicolons at end of property value are included in value
new_ec_test(semicolon_in_property comments.in test5.c
"^key=value; not comment[ \t\n\r]*$")
# test escaped semicolons are included in section names
new_ec_test(escaped_semicolon_in_section comments.in "test;.c"
"^key=value[ \t\n\r]*$")
# test octothorpe comments ignored before properties
new_ec_test(octothorpe_comment_before_props comments.in test9.c
"^key=value[ \t\n\r]*$")
# test octothorpe comments ignored between properties
new_ec_test_multiline(octothorpe_comment_between_props_ML comments.in test10.c
"key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*")
# test octothorpe at end of property value are included in value
new_ec_test(octothorpe_in_value comments.in test11.c
"^key=value# not comment[ \t\n\r]*$")
# test escaped octothorpes are included in section names
new_ec_test(escaped_octothorpe_in_section comments.in "test\#.c"
"^key=value[ \t\n\r]*$")
# test EditorConfig files with BOM at the head
new_ec_test(bom_at_head bom.in "a.c" "^key=value[ \t\n\r]*$")
# test EditorConfig files with CRLF line separators
new_ec_test(crlf_linesep crlf.in "a.c" "^key=value[ \t\n\r]*$")
# Test max property name and values
new_ec_test(max_property_name limits.in test1
"^00000000000000000000000000000000000000000000000001=50[ \t\n\r]*$")
new_ec_test(max_property_value limits.in test2
"^k255=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001[ \t\n\r]*$")
# Test max section names
new_ec_test(max_section_name_ok limits.in test3 "^key=value[ \t\n\r]*$")
new_ec_test(max_section_name_ignore limits.in test4 "^[ \t\n\r]*$")
# Empty .editorconfig files
new_ec_test(empty_editorconfig_file empty.in test4 "^[ \t\n\r]*$")
new_ec_test(newlines_only_editorconfig_file newlines_only.in test4 "^[ \t\n\r]*$")
new_ec_test(comments_only_editorconfig_file comments_only.in test4 "^[ \t\n\r]*$")
new_ec_test(comments_and_newlines_editorconfig_file comments_and_newlines.in test4 "^[ \t\n\r]*$")