Do not allow removeSurrounding remove overlapping prefix and suffix.

This commit is contained in:
Ilya Gorbunov
2015-10-29 20:43:32 +03:00
parent 05fd2b012a
commit 1400bdc09a
2 changed files with 6 additions and 2 deletions
+4
View File
@@ -436,6 +436,8 @@ class StringTest {
assertEquals("<value", "<value".removeSurrounding(pre, post), "Only removes surrounding when both prefix and suffix present")
assertEquals("value>", "value>".removeSurrounding(pre, post), "Only removes surrounding when both prefix and suffix present")
assertEquals("value", "value".removeSurrounding(pre, post))
assertEquals("<->", "<->".removeSurrounding(arg1("<-"), arg1("->")), "Does not remove overlapping prefix and suffix")
}
@test fun removePrefixCharSequence() = withTwoCharSequenceArgs { arg1, arg2 ->
@@ -466,6 +468,8 @@ class StringTest {
assertContentEquals("<value", "<value".removeSurrounding("<", ">"), "Only removes surrounding when both prefix and suffix present")
assertContentEquals("value>", "value>".removeSurrounding("<", ">"), "Only removes surrounding when both prefix and suffix present")
assertContentEquals("value", "value".removeSurrounding("<", ">"))
assertContentEquals("<->", "<->".removeSurrounding("<-", "->"), "Does not remove overlapping prefix and suffix")
}
/*