diff options
author | Josh Haberman <jhaberman@gmail.com> | 2015-07-10 16:36:59 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2015-07-10 16:36:59 -0700 |
commit | b0500b37b231b8f93a5b1b95e23d13830e11eb07 (patch) | |
tree | da6aab20d86574dee821130e36741d02ccfd83c2 /conformance/conformance.proto | |
parent | fe50044041e8b8bc6b8d8183e8d043ed6dba403e (diff) | |
download | protobuf-b0500b37b231b8f93a5b1b95e23d13830e11eb07.tar.gz protobuf-b0500b37b231b8f93a5b1b95e23d13830e11eb07.tar.bz2 protobuf-b0500b37b231b8f93a5b1b95e23d13830e11eb07.zip |
Added support for Json and valid input to conformance tests.
This was enabled by the recent open-sourcing of JSON
support and MessageDifferencer.
MessageDifferencer allows the conformance suite to expand
because it allows us to write tests for payloads that parse
successfully. To verify the testee's output payload, we
need to parse it back into a message and compare the message
instances. Comparing output bytes vs. a golden message is
*not* valid, because protobufs do not have a canonical
encoding (especially in the presence of maps, which have
no prescribed serialization order).
We only add one small JSON test for now, but with the
framework in place we now have the foundation to dramatically
expand the coverage of the conformance test suite.
Also added the ability for the testee to skip tests that
exercise features that are unimplemented. This allows
Java (which currently has no JSON support) to skip tests
involving JSON.
Change-Id: I697b4363da432b61ae3b638b4287c4cda1af4deb
Diffstat (limited to 'conformance/conformance.proto')
-rw-r--r-- | conformance/conformance.proto | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/conformance/conformance.proto b/conformance/conformance.proto index 39eafdbb..714cbe78 100644 --- a/conformance/conformance.proto +++ b/conformance/conformance.proto @@ -51,6 +51,12 @@ option java_package = "com.google.protobuf.conformance"; // - running as a sub-process may be more tricky in unusual environments like // iOS apps, where fork/stdin/stdout are not available. +enum WireFormat { + UNSPECIFIED = 0; + PROTOBUF = 1; + JSON = 2; +} + // Represents a single test case's input. The testee should: // // 1. parse this proto (which should always succeed) @@ -64,14 +70,8 @@ message ConformanceRequest { string json_payload = 2; } - enum RequestedOutput { - UNSPECIFIED = 0; - PROTOBUF = 1; - JSON = 2; - } - // Which format should the testee serialize its message to? - RequestedOutput requested_output = 3; + WireFormat requested_output_format = 3; } // Represents a single test case's output. @@ -96,6 +96,10 @@ message ConformanceResponse { // If the input was successfully parsed and the requested output was JSON, // serialize to JSON and set it in this field. string json_payload = 4; + + // For when the testee skipped the test, likely because a certain feature + // wasn't supported, like JSON input/output. + string skipped = 5; } } |