Add tests to demonstrate json parsing for null Timestamp and Duration types

pull/2377/head
Mark Costello 8 years ago
parent 83d6411bf3
commit cb54caff01
No known key found for this signature in database
GPG Key ID: 19EFFC5B0CFDFE8B
  1. 8
      conformance/conformance_test.cc

@ -1771,6 +1771,10 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
R"({"repeatedDuration": ["1.5s", "-1.5s"]})", R"({"repeatedDuration": ["1.5s", "-1.5s"]})",
"repeated_duration: {seconds: 1 nanos: 500000000}" "repeated_duration: {seconds: 1 nanos: 500000000}"
"repeated_duration: {seconds: -1 nanos: -500000000}"); "repeated_duration: {seconds: -1 nanos: -500000000}");
RunValidJsonTest(
"DurationNull", REQUIRED,
R"({"optionalDuration": null})",
"");
ExpectParseFailureForJson( ExpectParseFailureForJson(
"DurationMissingS", REQUIRED, "DurationMissingS", REQUIRED,
@ -1840,6 +1844,10 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
"TimestampWithNegativeOffset", REQUIRED, "TimestampWithNegativeOffset", REQUIRED,
R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})", R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})",
"optional_timestamp: {seconds: 0}"); "optional_timestamp: {seconds: 0}");
RunValidJsonTest(
"TimestampNull", REQUIRED,
R"({"optionalTimestamp": null})",
"");
ExpectParseFailureForJson( ExpectParseFailureForJson(
"TimestampJsonInputTooSmall", REQUIRED, "TimestampJsonInputTooSmall", REQUIRED,

Loading…
Cancel
Save