summaryrefslogtreecommitdiffstats
path: root/mfbt/tests
diff options
context:
space:
mode:
authorAlex Gaynor <agaynor@mozilla.com>2018-05-22 13:04:59 -0400
committerwolfbeast <mcwerewolf@gmail.com>2018-06-29 07:59:58 +0200
commitffbe05e06776f7e7e7233e74578312781888a249 (patch)
tree51445084435d753aa7c80ca538294ee689848117 /mfbt/tests
parent8ed2f59cc5f07299dfedc658283eb0ea4b49e08c (diff)
downloadUXP-ffbe05e06776f7e7e7233e74578312781888a249.tar
UXP-ffbe05e06776f7e7e7233e74578312781888a249.tar.gz
UXP-ffbe05e06776f7e7e7233e74578312781888a249.tar.lz
UXP-ffbe05e06776f7e7e7233e74578312781888a249.tar.xz
UXP-ffbe05e06776f7e7e7233e74578312781888a249.zip
Bug 1462912 - Fixed BufferList::Extract to handle the case where the call consumes the entirety of the BufferList. r=froydnj, a=RyanVM
Diffstat (limited to 'mfbt/tests')
-rw-r--r--mfbt/tests/TestBufferList.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/mfbt/tests/TestBufferList.cpp b/mfbt/tests/TestBufferList.cpp
index 207fa106f..325f8a3aa 100644
--- a/mfbt/tests/TestBufferList.cpp
+++ b/mfbt/tests/TestBufferList.cpp
@@ -279,5 +279,17 @@ int main(void)
MOZ_RELEASE_ASSERT(bl9.Size() == 8);
MOZ_RELEASE_ASSERT(!iter.Done());
+ BufferList bl10(0, 0, 8);
+ bl10.WriteBytes("abcdefgh", 8);
+ bl10.WriteBytes("12345678", 8);
+ iter = bl10.Iter();
+ BufferList bl11 = bl10.Extract(iter, 16, &success);
+ MOZ_RELEASE_ASSERT(success);
+ MOZ_RELEASE_ASSERT(bl11.Size() == 16);
+ MOZ_RELEASE_ASSERT(iter.Done());
+ iter = bl11.Iter();
+ MOZ_RELEASE_ASSERT(bl11.ReadBytes(iter, data, 16));
+ MOZ_RELEASE_ASSERT(memcmp(data, "abcdefgh12345678", 16) == 0);
+
return 0;
}