]> Cypherpunks repositories - gostls13.git/commit
bytes, strings: add tests for TrimLeftFunc and TrimRightFunc
authorBen Hoyt <benhoyt@gmail.com>
Thu, 28 Mar 2019 21:49:43 +0000 (17:49 -0400)
committerIan Lance Taylor <iant@golang.org>
Fri, 29 Mar 2019 14:16:35 +0000 (14:16 +0000)
commit154e5abfcdb8ffe193d2af4c8ef590f4d9a27008
tree2cd1000a508699aba19b11cefbf57e1da7964ca6
parentddef157813686870e26c3c2c83bd5af6bef71a61
bytes, strings: add tests for TrimLeftFunc and TrimRightFunc

When I was working on the fix for #31038 (make TrimSpace return nil on
all-space input) I noticed that there were no tests for TrimLeftFunc
and TrimRightFunc, including the funky nil behavior. So add some!

I've just reused the existing TrimFunc test cases for TrimLeftFunc and
TrimRightFunc, as well as adding new tests for the empty string and
all-trimmed cases (which test the nil-returning behavior of TrimFunc and
TrimLeftFunc).

Change-Id: Ib580d4364e9b3c91350305f9d9873080d7862904
Reviewed-on: https://go-review.googlesource.com/c/go/+/170061
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/bytes/bytes_test.go
src/strings/strings_test.go