| 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 tab_width default |
| 28 |
new_ec_test_multiline(tab_width_default_ML tab_width_default.in test.c |
| 29 |
"indent_size=4[ \t]*[\n\r]+indent_style=space[ \t]*[\n\r]+tab_width=4[\t\n\r]*") |
| 30 |
|
| 31 |
# Tab_width should not be set to any value if indent_size is "tab" and |
| 32 |
# tab_width is not set |
| 33 |
new_ec_test_multiline(tab_width_default_indent_size_tab_ML tab_width_default.in test2.c |
| 34 |
"indent_size=tab[ \t]*[\n\r]+indent_style=tab[ \t\n\r]*") |
| 35 |
|
| 36 |
# Test indent_size default. When indent_style is "tab", indent_size defaults to |
| 37 |
# "tab". |
| 38 |
new_ec_test_multiline(indent_size_default_ML indent_size_default.in test.c |
| 39 |
"indent_size=tab[ \t]*[\n\r]+indent_style=tab[ \t\n\r]*") |
| 40 |
|
| 41 |
# Test indent_size default. When indent_style is "tab", indent_size should have |
| 42 |
# no default value for version prior than 0.9.0. |
| 43 |
new_ec_test_version(indent_size_default_pre_0_9_0 indent_size_default.in test.c |
| 44 |
"^indent_style=tab[ \t\n\r]*$" 0.8.0) |
| 45 |
|
| 46 |
# Test indent_size default. When indent_style is "space", indent_size has no |
| 47 |
# default value. |
| 48 |
new_ec_test(indent_size_default_space indent_size_default.in test2.c |
| 49 |
"^indent_style=space[ \t\n\r]*$") |
| 50 |
|
| 51 |
# Test indent_size default. When indent_style is "tab" and tab_width is set, |
| 52 |
# indent_size should default to tab_width |
| 53 |
new_ec_test_multiline(indent_size_default_with_tab_width_ML |
| 54 |
indent_size_default.in test3.c |
| 55 |
"indent_size=2[ \t]*[\n\r]+indent_style=tab[ \t]*[\n\r]+tab_width=2[ \t\n\r]*") |
| 56 |
|
| 57 |
# test that same property values are lowercased (v0.9.0 properties) |
| 58 |
new_ec_test_multiline(lowercase_values1_ML lowercase_values.in test1.c |
| 59 |
"end_of_line=crlf[ \t]*[\n\r]+indent_style=space[ \t\n\r]*") |
| 60 |
|
| 61 |
# test that same property values are lowercased (v0.9.0 properties) |
| 62 |
new_ec_test_multiline(lowercase_values2_ML lowercase_values.in test2.c |
| 63 |
"charset=utf-8[ \t]*[\n\r]+insert_final_newline=true[ \t]*[\n\r]+trim_trailing_whitespace=false[ \t\n\r]*$") |
| 64 |
|
| 65 |
# test that same property values are not lowercased |
| 66 |
new_ec_test(lowercase_values3 lowercase_values.in test3.c |
| 67 |
"^test_property=TestValue[ \t\n\r]*$") |
| 68 |
|
| 69 |
# test that all property names are lowercased |
| 70 |
new_ec_test(lowercase_names lowercase_names.in test.c |
| 71 |
"^testproperty=testvalue[ \t\n\r]*$") |