From 7403ee9d07a1b096e9628871bd97e39f464c3aa5 Mon Sep 17 00:00:00 2001 From: MichaƂ Krasnoborski Date: Wed, 1 Feb 2017 23:47:03 +0100 Subject: Adjust heuristics to better handle "{}..." format strings. --- src/libcoretest/fmt/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/libcoretest') diff --git a/src/libcoretest/fmt/mod.rs b/src/libcoretest/fmt/mod.rs index 71b3a440f7b..5d204c7d523 100644 --- a/src/libcoretest/fmt/mod.rs +++ b/src/libcoretest/fmt/mod.rs @@ -31,8 +31,10 @@ fn test_pointer_formats_data_pointer() { #[test] fn test_estimated_capacity() { + assert_eq!(format_args!("").estimated_capacity(), 0); assert_eq!(format_args!("{}", "").estimated_capacity(), 0); assert_eq!(format_args!("Hello").estimated_capacity(), 5); assert_eq!(format_args!("Hello, {}!", "").estimated_capacity(), 16); - assert_eq!(format_args!("{}, hello!", "World").estimated_capacity(), 16); + assert_eq!(format_args!("{}, hello!", "World").estimated_capacity(), 0); + assert_eq!(format_args!("{}. 16-bytes piece", "World").estimated_capacity(), 32); } -- cgit 1.4.1-3-g733a5