summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-08-08 11:33:58 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-08-09 10:20:50 (GMT)
commit27090096ef3dc572515c23e2ec92e5ee19432950 (patch)
tree2cee785fef19832b0f69c64256845d800dee4d4a /Tests
parent242435a9c891bda62880b77d6d612a8975f11059 (diff)
downloadCMake-27090096ef3dc572515c23e2ec92e5ee19432950.zip
CMake-27090096ef3dc572515c23e2ec92e5ee19432950.tar.gz
CMake-27090096ef3dc572515c23e2ec92e5ee19432950.tar.bz2
cmStringAlgorithms: Add cmRemoveQuotes
- Add `cmRemoveQuotes` function to cmStringAlgorithms - Remove unused removeQuotes inline functions
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLib/testStringAlgorithms.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx
index 55d2a8f..f833502 100644
--- a/Tests/CMakeLib/testStringAlgorithms.cxx
+++ b/Tests/CMakeLib/testStringAlgorithms.cxx
@@ -51,6 +51,29 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ [])
}
// ----------------------------------------------------------------------
+ // Test cmRemoveQuotes
+ {
+ auto test = [&assert_string](cm::string_view source,
+ cm::string_view expected,
+ cm::string_view title) {
+ assert_string(cmRemoveQuotes(source), expected, title);
+ };
+
+ test("", "", "cmRemoveQuotes empty");
+ test("\"", "\"", "cmRemoveQuotes single quote");
+ test("\"\"", "", "cmRemoveQuotes double quote");
+ test("\"a", "\"a", "cmRemoveQuotes quote char");
+ test("\"ab", "\"ab", "cmRemoveQuotes quote char char");
+ test("a\"", "a\"", "cmRemoveQuotes char quote");
+ test("ab\"", "ab\"", "cmRemoveQuotes char char quote");
+ test("a", "a", "cmRemoveQuotes single char");
+ test("ab", "ab", "cmRemoveQuotes two chars");
+ test("abc", "abc", "cmRemoveQuotes three chars");
+ test("\"abc\"", "abc", "cmRemoveQuotes quoted chars");
+ test("\"\"abc\"\"", "\"abc\"", "cmRemoveQuotes quoted quoted chars");
+ }
+
+ // ----------------------------------------------------------------------
// Test cmEscapeQuotes
{
assert_string(cmEscapeQuotes("plain"), "plain", "cmEscapeQuotes plain");