diff options
author | David Cole <david.cole@kitware.com> | 2011-12-01 19:03:24 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-12-01 19:03:24 (GMT) |
commit | 97142c76038606a1111918c1b5585d8e9caf1336 (patch) | |
tree | 2914beb70ceb4bfcde7525c4c8dcca8f22dfa54e /Tests/CMakeTests | |
parent | 333fd1131c539e60a8da6ad1e8516009eabf11c2 (diff) | |
parent | ac2e45d0893dd283c04c600e626bf80ea57d4a71 (diff) | |
download | CMake-97142c76038606a1111918c1b5585d8e9caf1336.zip CMake-97142c76038606a1111918c1b5585d8e9caf1336.tar.gz CMake-97142c76038606a1111918c1b5585d8e9caf1336.tar.bz2 |
Merge topic 'newline-style'
ac2e45d Provide std::ios_base typedef on GCC < 3
28c46ca cmNewLineStyle: Use cmStandardIncludes.h
75e83e9 cmNewLineStyle: Remove trailing comma in enum
be6502c bootstrap: Include cmNewLineStyle in build
a087490 Add NEWLINE_STYLE option to configure_file (#3957)
Diffstat (limited to 'Tests/CMakeTests')
5 files changed, 38 insertions, 0 deletions
diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake new file mode 100644 index 0000000..3b09eb0 --- /dev/null +++ b/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake @@ -0,0 +1,3 @@ +set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +file(WRITE ${file_name} "Data\n") +configure_file(${file_name} ${file_name}.out COPYONLY NEWLINE_STYLE DOS) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake new file mode 100644 index 0000000..133a67a --- /dev/null +++ b/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake @@ -0,0 +1,3 @@ +set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +file(WRITE ${file_name} "Data\n") +configure_file(${file_name} ${file_name}.out NEWLINE_STYLE) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake new file mode 100644 index 0000000..b7e619c --- /dev/null +++ b/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake @@ -0,0 +1,17 @@ +set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) + +function(test_eol style in out) + file(WRITE ${file_name} "${in}") + configure_file(${file_name} ${file_name}.out NEWLINE_STYLE ${style}) + file(READ ${file_name}.out new HEX) + if(NOT "${new}" STREQUAL "${out}") + message(FATAL_ERROR "No ${style} line endings") + endif() +endfunction() + +test_eol(DOS "a\n" "610d0a") +test_eol(WIN32 "b\n" "620d0a") +test_eol(CRLF "c\n" "630d0a") + +test_eol(UNIX "d\n" "640a") +test_eol(LF "e\n" "650a") diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake new file mode 100644 index 0000000..e8887c1 --- /dev/null +++ b/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake @@ -0,0 +1,3 @@ +set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +file(WRITE ${file_name} "Data\n") +configure_file(${file_name} ${file_name}.out NEWLINE_STYLE FOO) diff --git a/Tests/CMakeTests/ConfigureFileTest.cmake.in b/Tests/CMakeTests/ConfigureFileTest.cmake.in index c78a470..6cc61d9 100644 --- a/Tests/CMakeTests/ConfigureFileTest.cmake.in +++ b/Tests/CMakeTests/ConfigureFileTest.cmake.in @@ -6,6 +6,14 @@ set(Relative-RESULT 0) set(Relative-STDERR "Relative test file") set(BadArg-RESULT 1) set(BadArg-STDERR "called with incorrect number of arguments") +set(NewLineStyle-NoArg-RESULT 1) +set(NewLineStyle-NoArg-STDERR "NEWLINE_STYLE must set a style:") +set(NewLineStyle-WrongArg-RESULT 1) +set(NewLineStyle-WrongArg-STDERR "NEWLINE_STYLE sets an unknown style") +set(NewLineStyle-ValidArg-RESULT 0) +set(NewLineStyle-ValidArg-STDERR ) +set(NewLineStyle-COPYONLY-RESULT 1) +set(NewLineStyle-COPYONLY-STDERR "COPYONLY could not be used in combination") include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") check_cmake_test(ConfigureFile @@ -13,4 +21,8 @@ check_cmake_test(ConfigureFile DirOutput Relative BadArg + NewLineStyle-NoArg + NewLineStyle-WrongArg + NewLineStyle-ValidArg + NewLineStyle-COPYONLY ) |