From f10851e788e9559e579c3673f87569c695a62dc5 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 30 Jul 2015 17:30:53 +0200 Subject: [PATCH] Update heap size tests for Vec allocation strategy change. --- tests/unit/util/mem.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unit/util/mem.rs b/tests/unit/util/mem.rs index ff25ded0b31..c281d54c0c3 100644 --- a/tests/unit/util/mem.rs +++ b/tests/unit/util/mem.rs @@ -64,9 +64,12 @@ fn test_heap_size() { assert_eq!(x.heap_size_of_children(), 8); // An ascii string with 16 chars is 16 bytes in UTF-8. + assert_eq!(String::from("0123456789abcdef").heap_size_of_children(), 16); + + // … but RawVec::reserve gives twice the requested capacity. let mut x = String::new(); x.push_str("0123456789abcdef"); - assert_eq!(x.heap_size_of_children(), 16); + assert_eq!(x.heap_size_of_children(), 32); // Not on the heap. let x: Option = None;