-#15825 add isEmpty and nonEmpty to ByteStringBuilder
This commit is contained in:
parent
213a5a4300
commit
954a86bf80
2 changed files with 24 additions and 0 deletions
|
|
@ -80,6 +80,8 @@ class ByteStringSpec extends WordSpec with Matchers with Checkers {
|
|||
} yield (xs.slice(from, until), bytes)
|
||||
}
|
||||
|
||||
implicit val arbitraryByteStringBuilder: Arbitrary[ByteStringBuilder] = Arbitrary(ByteString.newBuilder)
|
||||
|
||||
def likeVector(bs: ByteString)(body: IndexedSeq[Byte] ⇒ Any): Boolean = {
|
||||
val vec = Vector(bs: _*)
|
||||
body(bs) == body(vec)
|
||||
|
|
@ -552,5 +554,17 @@ class ByteStringSpec extends WordSpec with Matchers with Checkers {
|
|||
"encoding Double in big-endian" in { check { slice: ArraySlice[Double] ⇒ testDoubleEncoding(slice, BIG_ENDIAN) } }
|
||||
"encoding Double in little-endian" in { check { slice: ArraySlice[Double] ⇒ testDoubleEncoding(slice, LITTLE_ENDIAN) } }
|
||||
}
|
||||
|
||||
"have correct empty info" when {
|
||||
"is empty" in {
|
||||
check { a: ByteStringBuilder ⇒ a.isEmpty }
|
||||
}
|
||||
"is nonEmpty" in {
|
||||
check { a: ByteStringBuilder ⇒
|
||||
a.putByte(1.toByte)
|
||||
a.nonEmpty
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue