forked from quic-go/quic-go
replace stream.LenOfDataForWriting by HasDataForWriting
The return value (the length of data for writing) was only used to determine if the stream has data for writing. Therefore it's easier to just return a bool. No functional change expected.
This commit is contained in:
@@ -774,7 +774,7 @@ var _ = Describe("Stream", func() {
|
||||
}).Should(Equal([]byte("foobar")))
|
||||
Consistently(done).ShouldNot(BeClosed())
|
||||
Expect(onDataCalled).To(BeTrue())
|
||||
Expect(str.LenOfDataForWriting()).To(Equal(protocol.ByteCount(6)))
|
||||
Expect(str.HasDataForWriting()).To(BeTrue())
|
||||
data := str.GetDataForWriting(1000)
|
||||
Expect(data).To(Equal([]byte("foobar")))
|
||||
Expect(str.writeOffset).To(Equal(protocol.ByteCount(6)))
|
||||
@@ -799,17 +799,17 @@ var _ = Describe("Stream", func() {
|
||||
return str.dataForWriting
|
||||
}).Should(Equal([]byte("foobar")))
|
||||
Consistently(done).ShouldNot(BeClosed())
|
||||
Expect(str.LenOfDataForWriting()).To(Equal(protocol.ByteCount(6)))
|
||||
Expect(str.HasDataForWriting()).To(BeTrue())
|
||||
data := str.GetDataForWriting(3)
|
||||
Expect(data).To(Equal([]byte("foo")))
|
||||
Expect(str.writeOffset).To(Equal(protocol.ByteCount(3)))
|
||||
Expect(str.dataForWriting).ToNot(BeNil())
|
||||
Expect(str.LenOfDataForWriting()).To(Equal(protocol.ByteCount(3)))
|
||||
Expect(str.HasDataForWriting()).To(BeTrue())
|
||||
data = str.GetDataForWriting(3)
|
||||
Expect(data).To(Equal([]byte("bar")))
|
||||
Expect(str.writeOffset).To(Equal(protocol.ByteCount(6)))
|
||||
Expect(str.dataForWriting).To(BeNil())
|
||||
Expect(str.LenOfDataForWriting()).To(Equal(protocol.ByteCount(0)))
|
||||
Expect(str.HasDataForWriting()).To(BeFalse())
|
||||
Eventually(done).Should(BeClosed())
|
||||
})
|
||||
|
||||
@@ -827,7 +827,7 @@ var _ = Describe("Stream", func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(n).To(Equal(3))
|
||||
}()
|
||||
Eventually(func() protocol.ByteCount { return str.LenOfDataForWriting() }).ShouldNot(BeZero())
|
||||
Eventually(func() bool { return str.HasDataForWriting() }).Should(BeTrue())
|
||||
s[0] = 'v'
|
||||
Expect(str.GetDataForWriting(3)).To(Equal([]byte("foo")))
|
||||
})
|
||||
@@ -961,11 +961,11 @@ var _ = Describe("Stream", func() {
|
||||
Expect(err).To(MatchError(testErr))
|
||||
}()
|
||||
Eventually(func() []byte { return str.dataForWriting }).ShouldNot(BeNil())
|
||||
Expect(str.LenOfDataForWriting()).ToNot(BeZero())
|
||||
Expect(str.HasDataForWriting()).To(BeTrue())
|
||||
str.Cancel(testErr)
|
||||
data := str.GetDataForWriting(6)
|
||||
Expect(data).To(BeNil())
|
||||
Expect(str.LenOfDataForWriting()).To(BeZero())
|
||||
Expect(str.HasDataForWriting()).To(BeFalse())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user