summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2014-08-04 16:47:22 (GMT)
committerBrad King <brad.king@kitware.com>2014-08-06 13:23:47 (GMT)
commit5b30ec28f9610b0e6d12b017d83fc362b0ef9ecf (patch)
treef65b3c668a8794db8419861839d705400a88e116 /Tests
parentffa373e71114727dd70f1a051414de573debb767 (diff)
downloadCMake-5b30ec28f9610b0e6d12b017d83fc362b0ef9ecf.zip
CMake-5b30ec28f9610b0e6d12b017d83fc362b0ef9ecf.tar.gz
CMake-5b30ec28f9610b0e6d12b017d83fc362b0ef9ecf.tar.bz2
file: Add ENCODING option to file(STRINGS) command (#10519)
Support extraction of UTF-8 strings.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/StringFileTest/CMakeLists.txt10
-rw-r--r--Tests/StringFileTest/test.utf83
2 files changed, 13 insertions, 0 deletions
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt
index 4fa5a86..683f969 100644
--- a/Tests/StringFileTest/CMakeLists.txt
+++ b/Tests/StringFileTest/CMakeLists.txt
@@ -55,6 +55,16 @@ else()
"file(STRINGS) incorrectly read from srec file [${infile_strings}]")
endif()
+#this file has utf-8 content
+file(STRINGS test.utf8 infile_strings ENCODING UTF-8)
+list(LENGTH infile_strings content_len)
+if(content_len MATCHES "3")
+ message("file(STRINGS) correctly read from utf8 file [${infile_strings}]")
+else()
+ message(SEND_ERROR
+ "file(STRINGS) incorrectly read from utf8 file [${infile_strings}]")
+endif()
+
# String test
string(REGEX MATCH "[cC][mM][aA][kK][eE]" rmvar "CMake is great")
string(REGEX MATCHALL "[cC][mM][aA][kK][eE]" rmallvar "CMake is better than cmake or CMake")
diff --git a/Tests/StringFileTest/test.utf8 b/Tests/StringFileTest/test.utf8
new file mode 100644
index 0000000..6c29170
--- /dev/null
+++ b/Tests/StringFileTest/test.utf8
@@ -0,0 +1,3 @@
+The value of π (pi) is 3.141593
+Line mixed with binary partially matches valid utf8: Ï€ is à93.1593
+à \ No newline at end of file