Summary:
Turns out that phabricator and arc unit do not actually run
tests in our internal repo and this one had a bunch of syntax errors.
doh
No test cases were changed, just fixing syntax.
Test Plan:
- fbconfig folly/test
- fbmake runtests
- saw all ok
- _bin/folly/test/json_test
[==========] Running 10 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 10 tests from Json
[ RUN ] Json.Unicode
[ OK ] Json.Unicode (0 ms)
[ RUN ] Json.Parse
[ OK ] Json.Parse (1 ms)
[ RUN ] Json.JavascriptSafe
[ OK ] Json.JavascriptSafe (0 ms)
[ RUN ] Json.Produce
[ OK ] Json.Produce (0 ms)
[ RUN ] Json.JsonEscape
[ OK ] Json.JsonEscape (0 ms)
[ RUN ] Json.JsonNonAsciiEncoding
[ OK ] Json.JsonNonAsciiEncoding (0 ms)
[ RUN ] Json.UTF8Retention
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0528 11:29:43.879976 17977 JsonTest.cpp:257] input: ♥ => json: "♥"
I0528 11:29:43.880077 17977 JsonTest.cpp:259] output: ♥ => json: "♥"
[ OK ] Json.UTF8Retention (1 ms)
[ RUN ] Json.UTF8EncodeNonAsciiRetention
I0528 11:29:43.880122 17977 JsonTest.cpp:284] input: ♥ => json: "\u2665"
I0528 11:29:43.880131 17977 JsonTest.cpp:286] output: ♥ => json: "\u2665"
[ OK ] Json.UTF8EncodeNonAsciiRetention (0 ms)
[ RUN ] Json.UTF8Validation
[ OK ] Json.UTF8Validation (0 ms)
[ RUN ] Json.ParseNonStringKeys
[ OK ] Json.ParseNonStringKeys (0 ms)
[----------] 10 tests from Json (2 ms total)
[----------] Global test environment tear-down
[==========] 10 tests from 1 test case ran. (2 ms total)
[ PASSED ] 10 tests.
Reviewed By: delong.j@fb.com
FB internal diff:
D826413
Blame Revision:
D805218
TEST(Json, ParseNonStringKeys) {
// test string keys
- EXPECT_EQ("a", parseJson("{\"a\":[]}").items().begin().first.asString());
+ EXPECT_EQ("a", parseJson("{\"a\":[]}").items().begin()->first.asString());
// check that we don't allow non-string keys as this violates the
// strict JSON spec (though it is emitted by the output of
opts.allow_non_string_keys = true;
auto val = parseJson("{1:[]}", opts);
- EXPECT_EQ(1, val.items().begin().first.asInteger());
+ EXPECT_EQ(1, val.items().begin()->first.asInt());
// test we can still read in strings
auto sval = parseJson("{\"a\":[]}", opts);
- EXPECT_EQ("a", sval.items().begin().first.asString());
+ EXPECT_EQ("a", sval.items().begin()->first.asString());
// test we can read in doubles
auto dval = parseJson("{1.5:[]}", opts);
- EXPECT_EQ(1.5, dval.items().begin().first.asDouble());
+ EXPECT_EQ(1.5, dval.items().begin()->first.asDouble());
}
BENCHMARK(jsonSerialize, iters) {