summaryrefslogtreecommitdiffstats
path: root/mfbt/tests/TestBufferList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mfbt/tests/TestBufferList.cpp')
-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;
}