From 59a7f96ae81624e95b5303f30885bd581ab418cb Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 22 May 2020 10:56:35 +0200 Subject: [PATCH] Update simple_allocation test in Heap Allocation post --- .../second-edition/posts/10-heap-allocation/index.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/blog/content/second-edition/posts/10-heap-allocation/index.md b/blog/content/second-edition/posts/10-heap-allocation/index.md index 2045729f..a0f10964 100644 --- a/blog/content/second-edition/posts/10-heap-allocation/index.md +++ b/blog/content/second-edition/posts/10-heap-allocation/index.md @@ -700,7 +700,7 @@ fn main(boot_info: &'static BootInfo) -> ! { It is very similar to the `kernel_main` function in our `main.rs`, with the differences that we don't invoke `println`, don't include any example allocations, and call `test_main` unconditionally. -Now we're ready to add a few test cases. First, we add a test that performs a simple allocation using [`Box`] and checks the allocated value, to ensure that basic allocations work: +Now we're ready to add a few test cases. First, we add a test that performs some simple allocations using [`Box`] and checks the allocated values, to ensure that basic allocations work: ```rust // in tests/heap_allocation.rs @@ -711,8 +711,10 @@ use alloc::boxed::Box; #[test_case] fn simple_allocation() { serial_print!("simple_allocation... "); - let heap_value = Box::new(41); - assert_eq!(*heap_value, 41); + let heap_value_1 = Box::new(41); + let heap_value_2 = Box::new(13); + assert_eq!(*heap_value_1, 41); + assert_eq!(*heap_value_2, 13); serial_println!("[ok]"); } ```