=htp #19099 fix encoding of empty stings
This commit is contained in:
parent
15cc65ce9d
commit
3dbb553b0e
3 changed files with 21 additions and 2 deletions
|
|
@ -22,9 +22,11 @@ trait CodecSpecSupport extends Matchers with BeforeAndAfterAll { self: Suite ⇒
|
|||
i
|
||||
}
|
||||
|
||||
lazy val emptyTextBytes = ByteString(emptyText, "UTF8")
|
||||
lazy val smallTextBytes = ByteString(smallText, "UTF8")
|
||||
lazy val largeTextBytes = ByteString(largeText, "UTF8")
|
||||
|
||||
val emptyText = ""
|
||||
val smallText = "Yeah!"
|
||||
val largeText =
|
||||
"""Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore
|
||||
|
|
|
|||
|
|
@ -32,6 +32,18 @@ abstract class CoderSpec extends WordSpec with CodecSpecSupport with Inspectors
|
|||
def extraTests(): Unit = {}
|
||||
|
||||
s"The ${Coder.encoding.value} codec" should {
|
||||
"produce valid data on immediate finish" in {
|
||||
streamDecode(Coder.newCompressor.finish()) should readAs(emptyText)
|
||||
}
|
||||
"properly encode an empty string" in {
|
||||
streamDecode(ourEncode(emptyTextBytes)) should readAs(emptyText)
|
||||
}
|
||||
"properly decode an empty string" in {
|
||||
ourDecode(streamEncode(emptyTextBytes)) should readAs(emptyText)
|
||||
}
|
||||
"properly round-trip encode/decode an empty string" in {
|
||||
ourDecode(ourEncode(emptyTextBytes)) should readAs(emptyText)
|
||||
}
|
||||
"properly encode a small string" in {
|
||||
streamDecode(ourEncode(smallTextBytes)) should readAs(smallText)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue