Fix up the conformance tests

- Update all the new runner cases to handle a skip result as a skip and not a failure.
- Make ObjC use the new serialize_error result if it fails to generate the data.
This commit is contained in:
Thomas Van Lenten 2016-01-05 16:31:40 -05:00
parent d19c26f2c8
commit df4e4d8717
3 changed files with 16 additions and 108 deletions

View File

@ -95,7 +95,7 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
case WireFormat_Protobuf:
response.protobufPayload = testMessage.data;
if (!response.protobufPayload) {
response.runtimeError =
response.serializeError =
[NSString stringWithFormat:@"Failed to make data from: %@", testMessage];
}
break;

View File

@ -356,6 +356,8 @@ void ConformanceTestSuite::ExpectParseFailureForProto(
RunTest(effective_test_name, request, &response);
if (response.result_case() == ConformanceResponse::kParseError) {
ReportSuccess(effective_test_name);
} else if (response.result_case() == ConformanceResponse::kSkipped) {
ReportSkip(effective_test_name, request, response);
} else {
ReportFailure(effective_test_name, request, response,
"Should have failed to parse, but didn't.");
@ -408,6 +410,11 @@ void ConformanceTestSuite::RunValidJsonTestWithValidator(
RunTest(effective_test_name, request, &response);
if (response.result_case() == ConformanceResponse::kSkipped) {
ReportSkip(effective_test_name, request, response);
return;
}
if (response.result_case() != ConformanceResponse::kJsonPayload) {
ReportFailure(effective_test_name, request, response,
"Expected JSON payload but got type %d.",
@ -444,6 +451,8 @@ void ConformanceTestSuite::ExpectParseFailureForJson(
RunTest(effective_test_name, request, &response);
if (response.result_case() == ConformanceResponse::kParseError) {
ReportSuccess(effective_test_name);
} else if (response.result_case() == ConformanceResponse::kSkipped) {
ReportSkip(effective_test_name, request, response);
} else {
ReportFailure(effective_test_name, request, response,
"Should have failed to parse, but didn't.");
@ -466,6 +475,8 @@ void ConformanceTestSuite::ExpectSerializeFailureForJson(
RunTest(effective_test_name, request, &response);
if (response.result_case() == ConformanceResponse::kSerializeError) {
ReportSuccess(effective_test_name);
} else if (response.result_case() == ConformanceResponse::kSkipped) {
ReportSkip(effective_test_name, request, response);
} else {
ReportFailure(effective_test_name, request, response,
"Should have failed to serialize, but didn't.");

View File

@ -1,107 +1,4 @@
# TODO(xiaofeng): These tests should be skipped (because objc doesn't support
# JSON) but currently they are reported as failures by the objc testee.
DurationProtoInputTooLarge.JsonOutput
DurationProtoInputTooSmall.JsonOutput
FieldMaskNumbersDontRoundTrip.JsonOutput
FieldMaskPathsDontRoundTrip.JsonOutput
FieldMaskTooManyUnderscore.JsonOutput
JsonInput.BoolFieldAllCapitalFalse
JsonInput.BoolFieldAllCapitalTrue
JsonInput.BoolFieldCamelCaseFalse
JsonInput.BoolFieldCamelCaseTrue
JsonInput.BoolFieldDoubleQuotedFalse
JsonInput.BoolFieldDoubleQuotedTrue
JsonInput.BoolFieldIntegerOne
JsonInput.BoolFieldIntegerZero
JsonInput.BoolMapFieldKeyNotQuoted
JsonInput.BytesFieldInvalidBase64Characters
JsonInput.BytesFieldNoPadding
JsonInput.DoubleFieldInfinityNotQuoted
JsonInput.DoubleFieldNanNotQuoted
JsonInput.DoubleFieldNegativeInfinityNotQuoted
JsonInput.DoubleFieldTooLarge
JsonInput.DoubleFieldTooSmall
JsonInput.DurationHas3FractionalDigits.Validator
JsonInput.DurationHas6FractionalDigits.Validator
JsonInput.DurationHas9FractionalDigits.Validator
JsonInput.DurationHasZeroFractionalDigit.Validator
JsonInput.DurationJsonInputTooLarge
JsonInput.DurationJsonInputTooSmall
JsonInput.DurationMissingS
JsonInput.EnumFieldNotQuoted
JsonInput.EnumFieldUnknownValue.Validator
JsonInput.FieldMaskInvalidCharacter
JsonInput.FieldNameDuplicate
JsonInput.FieldNameDuplicateDifferentCasing1
JsonInput.FieldNameDuplicateDifferentCasing2
JsonInput.FieldNameInLowerCamelCase.Validator
JsonInput.FieldNameNotQuoted
JsonInput.FieldNameWithMixedCases.Validator
JsonInput.FieldNameWithNumbers.Validator
JsonInput.FloatFieldInfinityNotQuoted
JsonInput.FloatFieldNanNotQuoted
JsonInput.FloatFieldNegativeInfinityNotQuoted
JsonInput.FloatFieldTooLarge
JsonInput.FloatFieldTooSmall
JsonInput.Int32FieldLeadingSpace
JsonInput.Int32FieldLeadingZero
JsonInput.Int32FieldNegativeWithLeadingZero
JsonInput.Int32FieldNotInteger
JsonInput.Int32FieldNotNumber
JsonInput.Int32FieldPlusSign
JsonInput.Int32FieldTooLarge
JsonInput.Int32FieldTooSmall
JsonInput.Int32FieldTrailingSpace
JsonInput.Int32MapFieldKeyNotQuoted
JsonInput.Int64FieldBeString.Validator
JsonInput.Int64FieldNotInteger
JsonInput.Int64FieldNotNumber
JsonInput.Int64FieldTooLarge
JsonInput.Int64FieldTooSmall
JsonInput.Int64MapFieldKeyNotQuoted
JsonInput.JsonWithComments
JsonInput.MapFieldKeyIsNull
JsonInput.MapFieldValueIsNull
JsonInput.OneofFieldDuplicate
JsonInput.RepeatedFieldMessageElementIsNull
JsonInput.RepeatedFieldPrimitiveElementIsNull
JsonInput.RepeatedFieldTrailingComma
JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool
JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotMessage
JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotString
JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotBool
JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotInt
JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotString
JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool
JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotMessage
JsonInput.StringFieldInvalidEscape
JsonInput.StringFieldNotAString
JsonInput.StringFieldSurrogateInWrongOrder
JsonInput.StringFieldUnpairedHighSurrogate
JsonInput.StringFieldUnpairedLowSurrogate
JsonInput.StringFieldUnterminatedEscape
JsonInput.StringFieldUppercaseEscapeLetter
JsonInput.TimestampHas3FractionalDigits.Validator
JsonInput.TimestampHas6FractionalDigits.Validator
JsonInput.TimestampHas9FractionalDigits.Validator
JsonInput.TimestampHasZeroFractionalDigit.Validator
JsonInput.TimestampJsonInputLowercaseT
JsonInput.TimestampJsonInputLowercaseZ
JsonInput.TimestampJsonInputMissingT
JsonInput.TimestampJsonInputMissingZ
JsonInput.TimestampJsonInputTooLarge
JsonInput.TimestampJsonInputTooSmall
JsonInput.TimestampZeroNormalized.Validator
JsonInput.TrailingCommaInAnObject
JsonInput.Uint32FieldNotInteger
JsonInput.Uint32FieldNotNumber
JsonInput.Uint32FieldTooLarge
JsonInput.Uint32MapFieldKeyNotQuoted
JsonInput.Uint64FieldBeString.Validator
JsonInput.Uint64FieldNotInteger
JsonInput.Uint64FieldNotNumber
JsonInput.Uint64FieldTooLarge
JsonInput.Uint64MapFieldKeyNotQuoted
TimestampProtoInputTooLarge.JsonOutput
TimestampProtoInputTooSmall.JsonOutput
# No tests currently failing.
#
# json input or output tests are skipped (in conformance_objc.m) as mobile
# platforms don't support json wire format to avoid code bloat.