diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-09-23 16:08:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-09-23 19:59:36 +0200 |
commit | 8cadfec386d0fb906dbe9b8ea8f918e61927e622 (patch) | |
tree | f9084ba87f2ac22e0e44bd1060ae260378275c96 /unotools/qa | |
parent | 4689f7579ac3db998bb0de07b0adbe4092d5be14 (diff) |
Fix utl::splitLastFromConfigurationPath
* Fix regressions introduced with 5edefc801fb48559c8064003f23d22d838710ee4 "use
more string_view in unotools". (Notably, misuses of two-argument std
string_view rfind are something to watch out for, see the commit message of
93e234c45c62af9d57041de676d888f7695ac0e8 "Fix a misuse of two-argument std
string_view rfind" for details.)
* Bring the implementation some more in accordance with the documentation, by
being stricter about handling invalid paths, and making sure to really assign
all of the input _sInPath to the output _rsLocalName in case of an invalid
path.
* Only &...;-decode the names of set elements in ['...'] and ["..."], not
anything else.
Change-Id: If01f4b34af42b0a594994b732d54f26695329286
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140493
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'unotools/qa')
-rw-r--r-- | unotools/qa/unit/configpaths.cxx | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/unotools/qa/unit/configpaths.cxx b/unotools/qa/unit/configpaths.cxx index e0a92f37c894..7d9907d9e34d 100644 --- a/unotools/qa/unit/configpaths.cxx +++ b/unotools/qa/unit/configpaths.cxx @@ -47,9 +47,6 @@ public: CPPUNIT_ASSERT_EQUAL(OUString(""), path); CPPUNIT_ASSERT_EQUAL(OUString("foo"), last); } - // TODO: Broken since 5edefc801fb48559c8064003f23d22d838710ee4 "use more string_view in - // unotools" (expected "" vs. actual "/foo"): - if ((false)) { // Already prior to 5edefc801fb48559c8064003f23d22d838710ee4 "use more string_view in // unotools", and in discordance with the documentation, this returned true (but @@ -65,9 +62,6 @@ public: CPPUNIT_ASSERT_EQUAL(OUString("/foo/bar"), path); CPPUNIT_ASSERT_EQUAL(OUString("baz"), last); } - // TODO: Broken since 5edefc801fb48559c8064003f23d22d838710ee4 "use more string_view in - // unotools" (expected "/foo/bar" vs. actual "/foo/bar/baz"): - if ((false)) { // Trailing slash accepted for backwards compatibility (cf // . "for backwards compatibility, ignore a final slash" comment in @@ -77,9 +71,6 @@ public: CPPUNIT_ASSERT_EQUAL(OUString("/foo/bar"), path); CPPUNIT_ASSERT_EQUAL(OUString("baz"), last); } - // TODO: Broken since 5edefc801fb48559c8064003f23d22d838710ee4 "use more string_view in - // unotools" (expected true vs. actual false return): - if ((false)) { OUString path, last; CPPUNIT_ASSERT(utl::splitLastFromConfigurationPath( @@ -93,18 +84,14 @@ public: CPPUNIT_ASSERT_EQUAL(OUString(""), path); CPPUNIT_ASSERT_EQUAL(OUString("foo"), last); } - // TODO: Broken since 5edefc801fb48559c8064003f23d22d838710ee4 "use more string_view in - // unotools" (expected false vs. actual true return): - if ((false)) { - // Already prior to 5edefc801fb48559c8064003f23d22d838710ee4 "use more string_view in - // unotools", and in discordance with the documentation, this set last to "foo" rather - // than "foo/" (but "If <var>_sInPath</var> could not be parsed as a valid configuration - // path, this is set to <var>_sInPath</var>"): + // In accordance with the documentation, this sets last to "foo/" ("If + // <var>_sInPath</var> could not be parsed as a valid configuration path, this is set to + // <var>_sInPath</var>"): OUString path, last; CPPUNIT_ASSERT(!utl::splitLastFromConfigurationPath(u"foo/", path, last)); CPPUNIT_ASSERT_EQUAL(OUString(""), path); - CPPUNIT_ASSERT_EQUAL(OUString("foo"), last); + CPPUNIT_ASSERT_EQUAL(OUString("foo/"), last); } { // Some broken input missing a leading slash happens to be considered OK: |