diff options
Diffstat (limited to 'Tests/RunCMake/cmake_path/NORMAL_PATH.cmake')
-rw-r--r-- | Tests/RunCMake/cmake_path/NORMAL_PATH.cmake | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake new file mode 100644 index 0000000..88db76a --- /dev/null +++ b/Tests/RunCMake/cmake_path/NORMAL_PATH.cmake @@ -0,0 +1,46 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set (path "a/./b/..") +cmake_path(NORMAL_PATH path) +if (NOT path STREQUAL "a/") + list (APPEND errors "'${path}' instead of 'a/'") +endif() + +set (path "a/.///b/../") +cmake_path(NORMAL_PATH path) +if (NOT path STREQUAL "a/") + list (APPEND errors "'${path}' instead of 'a/'") +endif() + +set (path "a/.///b/../") +cmake_path(NORMAL_PATH path OUTPUT_VARIABLE output) +if (NOT path STREQUAL "a/.///b/../") + list (APPEND errors "input changed unexpectedly") +endif() +if (NOT output STREQUAL "a/") + list (APPEND errors "'${output}' instead of 'a/'") +endif() + +if (WIN32) + set (path "//host/./b/..") + cmake_path(NORMAL_PATH path) + if (NOT path STREQUAL "//host/") + list (APPEND errors "'${path}' instead of '//host/'") + endif() + + set (path "//host/./b/../") + cmake_path(NORMAL_PATH path) + if (NOT path STREQUAL "//host/") + list (APPEND errors "'${path}' instead of '//host/'") + endif() + + set (path "c://a/.///b/../") + cmake_path(NORMAL_PATH path) + if (NOT path STREQUAL "c:/a/") + list (APPEND errors "'${path}' instead of 'c:/a/'") + endif() +endif() + +check_errors (NORMAL_PATH ${errors}) |