summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorJohnny Jazeix <jazeix@gmail.com>2020-10-13 21:48:12 (GMT)
committerBrad King <brad.king@kitware.com>2020-10-14 16:08:07 (GMT)
commitf7a5f283188c1e51b0fb549f0a78afaf1d570383 (patch)
treec5fade762b9cada9b7fd9cf964528c43ccd45c80 /Tests
parent90b39a52090e6ba52424b441d5827b2b6e11ff56 (diff)
downloadCMake-f7a5f283188c1e51b0fb549f0a78afaf1d570383.zip
CMake-f7a5f283188c1e51b0fb549f0a78afaf1d570383.tar.gz
CMake-f7a5f283188c1e51b0fb549f0a78afaf1d570383.tar.bz2
cmake: Fix '-E cat' command for binary files on Windows
Reset `std::cout` to write in binary mode with no encoding conversions. Co-Author: Brad King <brad.king@kitware.com> Fixes: #21295
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CommandLine/.gitattributes2
-rw-r--r--Tests/RunCMake/CommandLine/E_cat_binary_files/binary.objbin0 -> 124 bytes
-rw-r--r--Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txtbin0 -> 248 bytes
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake3
4 files changed, 5 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/.gitattributes b/Tests/RunCMake/CommandLine/.gitattributes
new file mode 100644
index 0000000..b0b0588
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/.gitattributes
@@ -0,0 +1,2 @@
+E_cat_binary_files/binary.obj -text
+E_cat_good_binary_cat-stdout.txt -text -whitespace
diff --git a/Tests/RunCMake/CommandLine/E_cat_binary_files/binary.obj b/Tests/RunCMake/CommandLine/E_cat_binary_files/binary.obj
new file mode 100644
index 0000000..73f1749
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_cat_binary_files/binary.obj
Binary files differ
diff --git a/Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txt b/Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txt
new file mode 100644
index 0000000..0951d85
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_cat_good_binary_cat-stdout.txt
Binary files differ
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 973391d..abb9050 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -498,6 +498,9 @@ run_cmake_command(E_cat_good_cat
${CMAKE_COMMAND} -E cat "${out}/first_file.txt" "${out}/second_file.txt" "${out}/unicode_file.txt")
unset(out)
+run_cmake_command(E_cat_good_binary_cat
+ ${CMAKE_COMMAND} -E cat "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj" "${RunCMake_SOURCE_DIR}/E_cat_binary_files/binary.obj")
+
run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env)
run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1)
run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1)