aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark Costello <mark@markcostello.net>2016-11-16 11:02:50 -0500
committerGravatar Mark Costello <mark@markcostello.net>2016-11-16 15:00:54 -0500
commitcb54caff01ef37b59889d6949e876b1ff6ee3a65 (patch)
treea109929aba9063db7024adb8ce38b0463751bf83
parent83d6411bf3c13f8f7fa884180830ee179bd37849 (diff)
Add tests to demonstrate json parsing for null Timestamp and Duration types
-rw-r--r--conformance/conformance_test.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc
index b74122c6..e9f3a8a8 100644
--- a/conformance/conformance_test.cc
+++ b/conformance/conformance_test.cc
@@ -1771,6 +1771,10 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
R"({"repeatedDuration": ["1.5s", "-1.5s"]})",
"repeated_duration: {seconds: 1 nanos: 500000000}"
"repeated_duration: {seconds: -1 nanos: -500000000}");
+ RunValidJsonTest(
+ "DurationNull", REQUIRED,
+ R"({"optionalDuration": null})",
+ "");
ExpectParseFailureForJson(
"DurationMissingS", REQUIRED,
@@ -1840,6 +1844,10 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
"TimestampWithNegativeOffset", REQUIRED,
R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})",
"optional_timestamp: {seconds: 0}");
+ RunValidJsonTest(
+ "TimestampNull", REQUIRED,
+ R"({"optionalTimestamp": null})",
+ "");
ExpectParseFailureForJson(
"TimestampJsonInputTooSmall", REQUIRED,