| 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 |
# Tests for version switches |
| 28 |
|
| 29 |
# test --version option returns version information |
| 30 |
new_ec_cli_test(NAME test_long_version_switch |
| 31 |
ARGS --version |
| 32 |
MATCH "^EditorConfig.* Version [0-9]+\\.[0-9]+\\.[0-9]+(-[a-z]+)?[ \t\n\r]$") |
| 33 |
|
| 34 |
# test -v option returns version information |
| 35 |
new_ec_cli_test(NAME test_short_version_switch |
| 36 |
ARGS -v |
| 37 |
MATCH "^EditorConfig.* Version [0-9]+\\.[0-9]+\\.[0-9]+(-[a-z]+)?[ \t\n\r]$") |
| 38 |
|
| 39 |
# Test for multiple input files |
| 40 |
|
| 41 |
# when files are specified on command line. The files can appear in either |
| 42 |
# order in the output, but each file's output line must be grouped with its |
| 43 |
# file header. Handle this by listing both possibilities manually in the regex. |
| 44 |
new_ec_cli_test(NAME multiple_files_on_command_line |
| 45 |
ARGS -f cli.in |
| 46 |
"${CMAKE_CURRENT_SOURCE_DIR}/file1.c" |
| 47 |
"${CMAKE_CURRENT_SOURCE_DIR}/file2.cpp" |
| 48 |
MATCH |
| 49 |
"^(\\[${CMAKE_CURRENT_SOURCE_DIR}/file1.c\\][ \t]*[\n\r]+key1=value1[ \t]*[\n\r]+\\[${CMAKE_CURRENT_SOURCE_DIR}/file2.cpp\\][ \t]*[\n\r]+key2=value2)|(\\[${CMAKE_CURRENT_SOURCE_DIR}/file2.cpp\\][ \t]*[\n\r]+key2=value2[ \t]*[\n\r]+\\[${CMAKE_CURRENT_SOURCE_DIR}/file1.c\\][ \t]*[\n\r]+key1=value1)[ \t\n\r]*$" |
| 50 |
) |