From: Louis Brandy Date: Fri, 27 Sep 2013 17:02:51 +0000 (-0700) Subject: add test for numeric -> string conversions X-Git-Tag: v0.22.0~861 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=442a46c311c0e1921cb8cd3e7f23d8fc4e610426;p=folly.git 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 --- 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) {