@@ -295,26 +295,26 @@ class MessagePackerTest extends MessagePackSpec {
295295
296296 " be able to disable STR8 for backward compatibility" in {
297297 val config = new PackerConfig ()
298- .withSmallStringOptimizationThreshold(0 ) // Disable small string optimiztion
299298 .withStr8FormatSupport(false )
300299
301- {
302- val packer = config.newBufferPacker()
303- packer.packString(" Hello. This is a string longer than 32 characters!" )
304- val unpacker = MessagePack .newDefaultUnpacker(packer.toByteArray)
305- val f = unpacker.getNextFormat
306- f shouldBe MessageFormat .STR16
307- }
300+ val packer = config.newBufferPacker()
301+ packer.packString(" Hello. This is a string longer than 32 characters!" )
302+ val unpacker = MessagePack .newDefaultUnpacker(packer.toByteArray)
303+ val f = unpacker.getNextFormat
304+ f shouldBe MessageFormat .STR16
305+ }
308306
309- {
310- val packer2 = config.newBufferPacker()
311- packer2.packString(" small string" )
312- packer2.flush()
313- val unpacker2 = MessagePack .newDefaultUnpacker(packer2.toByteArray)
314- val f2 = unpacker2.getNextFormat
315- f2 shouldNot be (MessageFormat .STR8 )
316- val s = unpacker2.unpackString()
317- s shouldBe " small string"
318- }
307+ " be able to disable STR8 when using CharsetEncoder" in {
308+ val config = new PackerConfig ()
309+ .withStr8FormatSupport(false )
310+ .withSmallStringOptimizationThreshold(0 ) // Disable small string optimization
311+
312+ val packer = config.newBufferPacker()
313+ packer.packString(" small string" )
314+ val unpacker = MessagePack .newDefaultUnpacker(packer.toByteArray)
315+ val f = unpacker.getNextFormat
316+ f shouldNot be (MessageFormat .STR8 )
317+ val s = unpacker.unpackString()
318+ s shouldBe " small string"
319319 }
320320}
0 commit comments