Github user vanzin commented on a diff in the pull request: https://github.com/apache/spark/pull/22213#discussion_r216094096 --- Diff: core/src/test/scala/org/apache/spark/util/UtilsSuite.scala --- @@ -1205,6 +1205,39 @@ class UtilsSuite extends SparkFunSuite with ResetSystemProperties with Logging { assert(Utils.stringHalfWidth("\u0967\u0968\u0969") == 3) // scalastyle:on nonascii } + + test("trimExceptCRLF standalone") { + val crlfSet = Set("\r", "\n") + val nonPrintableButCRLF = + (0 to 32).map(_.toChar.toString).toSet -- crlfSet + + // identity for CRLF + crlfSet + .foreach(s => Utils.trimExceptCRLF(s) === s) + + // empty for other non-printables + nonPrintableButCRLF + .foreach(s => assert(Utils.trimExceptCRLF(s) === "")) + + // identity for a printable string + assert(Utils.trimExceptCRLF("a") === "a") + + // identity for strings with CRLF + crlfSet + .foreach { s => --- End diff -- nit: keep in previous line (also below).
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org