From 442a46c311c0e1921cb8cd3e7f23d8fc4e610426 Mon Sep 17 00:00:00 2001 From: Louis Brandy Date: Fri, 27 Sep 2013 10:02:51 -0700 Subject: [PATCH] add test for numeric -> string conversions Summary: We don't test this functionality (pulling a number out as a string). Almost commited a bug this would have caught. Test Plan: Run the test. Reviewed By: delong.j@fb.com FB internal diff: D987607 --- folly/test/DynamicTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/folly/test/DynamicTest.cpp b/folly/test/DynamicTest.cpp index 163c6d35..8cfe0b55 100644 --- a/folly/test/DynamicTest.cpp +++ b/folly/test/DynamicTest.cpp @@ -216,6 +216,10 @@ TEST(Dynamic, Conversions) { EXPECT_EQ(str.asInt(), 0); EXPECT_EQ(str.asDouble(), 0); EXPECT_EQ(str.asString(), "0"); + + dynamic num = 12; + EXPECT_EQ("12", num.asString()); + EXPECT_EQ(12.0, num.asDouble()); } TEST(Dynamic, FormattedIO) { -- 2.34.1