mbeckerle commented on a change in pull request #129: Cross Testing Capability
with IBM DFDL
URL: https://github.com/apache/incubator-daffodil/pull/129#discussion_r234380997
##########
File path:
daffodil-tdml/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
##########
@@ -682,87 +774,64 @@ case class ParserTestCase(ptc: NodeSeq, parentArg:
DFDLTestSuite)
lazy val optExpectedInfoset = this.optExpectedOrInputInfoset
- override def runProcessor(schemaSource: DaffodilSchemaSource,
+ override def runProcessor(compileResult: TDML.CompileResult,
optDataToParse: Option[InputStream],
optLengthLimitInBits: Option[Long],
- optErrors: Option[ExpectedErrors],
- optWarnings: Option[ExpectedWarnings],
- optValidationErrors: Option[ExpectedValidationErrors],
+ optExpectedErrors: Option[ExpectedErrors],
+ optExpectedWarnings: Option[ExpectedWarnings],
+ optExpectedValidationErrors: Option[ExpectedValidationErrors],
validationMode: ValidationMode.Type,
roundTrip: RoundTrip,
tracer: Option[Debugger]) = {
- val useSerializedProcessor =
- if (validationMode == ValidationMode.Full) false
- else if (optWarnings.isDefined) false
- else true
+
val nBits = optLengthLimitInBits.get
val dataToParse = optDataToParse.get
- val processor = getProcessor(schemaSource, useSerializedProcessor)
- processor.right.foreach {
- case (warnings, proc) =>
- //
- // Print out the warnings
- // (JIRA DFDL-1583 is implementation of expected warnings checking.)
- //
- warnings.foreach { System.err.println(_) }
-
- setupDebugOrTrace(proc)
- }
-
- (optExpectedInfoset, optErrors) match {
- case (Some(infoset), None) => {
- processor.left.foreach { diags => throw new TDMLException(diags) }
- processor.right.foreach {
- case (warnings, processor) =>
- runParseExpectSuccess(processor, dataToParse, nBits, optWarnings,
optValidationErrors, validationMode, roundTrip)
+ (optExpectedInfoset, optExpectedErrors) match {
+ case (Some(_), None) => {
+ compileResult.left.foreach { diags => throw new TDMLException(diags) }
+ compileResult.right.foreach {
+ case (_, processor) =>
+ runParseExpectSuccess(processor, dataToParse, nBits,
optExpectedWarnings, optExpectedValidationErrors, validationMode, roundTrip)
}
}
- case (None, Some(errors)) => {
- processor.left.foreach { diags =>
- VerifyTestCase.verifyAllDiagnosticsFound(diags, Some(errors))
+ case (None, Some(_)) => {
+ compileResult.left.foreach { diags =>
+ VerifyTestCase.verifyAllDiagnosticsFound(diags, optExpectedErrors)
Review comment:
Roughly, yes. Negative tests can be checked to be sure they fail, but
whether a coherent set of errors strings can be created that are universal
while preventing a false match by being too lax.... not easy really. We may end
up wanting to create two tests. One of which is for each implementation, but
which share the schema and data, just are different w.r.t. error message
expectations. I don't want to go too far down this road though until we get the
basic stuff working.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services