diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-12-10 05:42:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-12-10 06:40:01 +0300 |
commit | 15d801625cbb2566815a6fed2fc036a14336fec0 (patch) | |
tree | d9f73879e45ffac3f4494ddecc4fad16ed5a856e /source/blender/blenlib/tests | |
parent | 7fc1d760378f5c538c44bc4730c98af820678e4d (diff) |
BLI_string: add BLI_str_unescape utility function
Performs the reverse of BLI_str_escape.
This allows logic to be removed from RNA path handling.
Diffstat (limited to 'source/blender/blenlib/tests')
-rw-r--r-- | source/blender/blenlib/tests/BLI_string_test.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenlib/tests/BLI_string_test.cc b/source/blender/blenlib/tests/BLI_string_test.cc index 7ef2f5a888e..4b6cad12813 100644 --- a/source/blender/blenlib/tests/BLI_string_test.cc +++ b/source/blender/blenlib/tests/BLI_string_test.cc @@ -803,7 +803,7 @@ TEST_F(StringCasecmpNatural, TextAndNumbers) testReturnsMoreThanZeroForAll(positive); } -/* BLI_str_escape */ +/* BLI_str_escape, BLI_str_unescape */ class StringEscape : public testing::Test { protected: @@ -822,6 +822,10 @@ class StringEscape : public testing::Test { dst_test_len = BLI_str_escape(dst_test, item[0], SIZE_MAX); EXPECT_STREQ(dst_test, item[1]); EXPECT_EQ(dst_test_len, strlen(dst_test)); + /* Escape back. */ + dst_test_len = BLI_str_unescape(dst_test, item[1], strlen(item[1])); + EXPECT_STREQ(dst_test, item[0]); + EXPECT_EQ(dst_test_len, strlen(dst_test)); } } }; |