| 1 |
# |
| 2 |
# Copyright (c) 2011-2018 EditorConfig Team |
| 3 |
# All rights reserved. |
| 4 |
# |
| 5 |
# Redistribution and use in source and binary forms, with or without |
| 6 |
# modification, are permitted provided that the following conditions are met: |
| 7 |
# |
| 8 |
# 1. Redistributions of source code must retain the above copyright notice, |
| 9 |
# this list of conditions and the following disclaimer. |
| 10 |
# 2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 |
# this list of conditions and the following disclaimer in the documentation |
| 12 |
# and/or other materials provided with the distribution. |
| 13 |
# |
| 14 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 15 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 17 |
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 18 |
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 19 |
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 20 |
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 21 |
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 22 |
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 23 |
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 24 |
# POSSIBILITY OF SUCH DAMAGE. |
| 25 |
# |
| 26 |
|
| 27 |
# Test for EditorConfig file in parent directory |
| 28 |
new_ec_test(parent_directory parent_directory.in parent_directory/test.a "^key=value[ \t\n\r]*$") |
| 29 |
|
| 30 |
# Test for EditorConfig file in parent directory and current directory |
| 31 |
new_ec_test_multiline(parent_and_current_dir_ML |
| 32 |
parent_directory.in parent_directory/test.b |
| 33 |
"key1=value1[ \t]*[\n\r]+key2=value2[ \t\n\r]*") |
| 34 |
|
| 35 |
# Test for file in parent directory and overloaded by file in current directory |
| 36 |
new_ec_test(parent_dir_overload parent_directory.in parent_directory/test.c "^key=valueB[ \t\n\r]*$") |
| 37 |
|
| 38 |
# Test for file in parent directory and overloaded by file in current directory and repeated in current directory |
| 39 |
new_ec_test(parent_dir_overload_repeat parent_directory.in parent_directory/test.d "^key=value_c[ \t\n\r]*$") |
| 40 |
|
| 41 |
# Test for file in parent directory and overloaded by file in current directory and repeated in current directory, with different patterns |
| 42 |
new_ec_test(parent_dir_overload_repeat2 parent_directory.in parent_directory/test.e "^key=value_g[ \t\n\r]*$") |
| 43 |
|
| 44 |
# Test that search stops at root EditorConfig file |
| 45 |
new_ec_test(root_file root_file.in root_file/test.a "^[ \t\n\r]*$") |
| 46 |
|
| 47 |
# Test that search stops at root EditorConfig file |
| 48 |
new_ec_test(root_file_mixed_case root_file.in root_mixed/test.a "^child=true[ \t\n\r]*$") |
| 49 |
|
| 50 |
# Test that search stops at root EditorConfig file |
| 51 |
new_ec_test(root_pattern root_file.in root "^name=root[ \t\n\r]*$") |
| 52 |
|
| 53 |
# Tests path separator match |
| 54 |
new_ec_test(path_separator path_separator.in path/separator "^key1=value1[ \t\n\r]*$") |
| 55 |
|
| 56 |
# Windows style path separator in the command line should work on Windows, but |
| 57 |
# should not work on other systems (including Cygwin) |
| 58 |
if(WIN32) |
| 59 |
set(path_separator_backslash_in_cmd_line_regex "^key1=value1[ \t\n\r]*$") |
| 60 |
else(WIN32) |
| 61 |
set(path_separator_backslash_in_cmd_line_regex "^[ \t\n\r]*$") |
| 62 |
endif(WIN32) |
| 63 |
new_ec_test_full_ec_file_path(path_separator_backslash_in_cmd_line |
| 64 |
path_separator.in |
| 65 |
"${CMAKE_CURRENT_SOURCE_DIR}\\path\\separator" |
| 66 |
${path_separator_backslash_in_cmd_line_regex}) |
| 67 |
|
| 68 |
# Tests path separator match below top of path |
| 69 |
new_ec_test(nested_path_separator path_separator.in nested/path/separator "^[ \t\n\r]*$") |
| 70 |
|
| 71 |
# Tests path separator match top of path only |
| 72 |
new_ec_test(top_level_path_separator path_separator.in top/of/path "^key2=value2[ \t\n\r]*$") |
| 73 |
|
| 74 |
# Tests path separator match top of path only |
| 75 |
new_ec_test(top_level_path_separator_neg path_separator.in not/top/of/path "^[ \t\n\r]*$") |
| 76 |
|
| 77 |
# Test Windows-style path separator (backslash) does not work |
| 78 |
new_ec_test(windows_separator path_separator.in windows/separator "^[ \t\n\r]*$") |
| 79 |
|
| 80 |
# Test again that Windows-style path separator (backslash) does not work |
| 81 |
new_ec_test(windows_separator2 path_separator.in windows/separator2 "^[ \t\n\r]*$") |
| 82 |
|
| 83 |
# Globs with backslash in it but should be considered as file name on Non-Windows system |
| 84 |
if((NOT WIN32) AND (NOT CYGWIN)) |
| 85 |
new_ec_test(backslash_not_on_windows path_separator.in "windows\\separator2" "^key4=value4[ \t\n\r]*$") |
| 86 |
endif() |
| 87 |
|
| 88 |
new_ec_test(path_with_special_chars path_with_special_chars.in "path_with_special_[chars/test.a" "^key=value[ \t\n\r]*$") |
| 89 |
## " <-- resync the syntax highlighter |
| 90 |
|
| 91 |
# Test the unset value with various common properties |
| 92 |
new_ec_test(unset_charset unset.in unset/charset.txt "^charset=unset[ \t\n\r]*$") |
| 93 |
new_ec_test(unset_end_of_line unset.in unset/end_of_line.txt "^end_of_line=unset[ \t\n\r]*$") |
| 94 |
new_ec_test_multiline(unset_indent_size_ML unset.in unset/indent_size.txt |
| 95 |
"indent_size=unset[ \t\n\r]*tab_width=unset[ \t\n\r]*") |
| 96 |
new_ec_test(unset_indent_style unset.in unset/indent_style.txt "^indent_style=unset[ \t\n\r]*$") |
| 97 |
new_ec_test(unset_insert_final_newline unset.in unset/insert_final_newline.txt "^insert_final_newline=unset[ \t\n\r]*$") |
| 98 |
new_ec_test(unset_tab_width unset.in unset/tab_width.txt "^tab_width=unset[ \t\n\r]*$") |
| 99 |
new_ec_test(unset_trim_trailing_whitespace unset.in unset/trim_trailing_whitespace.txt "^trim_trailing_whitespace=unset[ \t\n\r]*$") |