tuxji commented on code in PR #831:
URL: https://github.com/apache/daffodil/pull/831#discussion_r950939129
##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala:
##########
@@ -160,9 +160,15 @@ final class TDMLDFDLProcessorFactory private (
optRootName: Option[String],
optRootNamespace: Option[String],
tunables: Map[String, String]): TDML.CompileResult = {
-
- val res = compileProcessor(schemaSource, useSerializedProcessor,
optRootName, optRootNamespace)
- res
+ if (schemaSource.isXSD) {
+ val res = compileProcessor(schemaSource, useSerializedProcessor,
optRootName, optRootNamespace)
+ res
+ } else {
+ val dp = compiler.reload(schemaSource)
+ val diags = dp.getDiagnostics
+ Assert.invariant(diags.forall{! _.isError })
+ Right((diags, new DaffodilTDMLDFDLProcessor(dp)))
+ }
Review Comment:
You've added a test that takes us to line 167 and calls compiler.reload but
the test forces that method to throw an InvalidParserException("The saved
parser is only compatible with Daffodil " + savedVersion + ". Current version
is " + curVersion) and we never get to lines 168 and 170, hence the coverage
check warnings on these lines.
You could write a test `testNonXSDModelPositiveGoodCompiledFile` which
creates a parser, saves it to a temporary file (deleted automatically later),
interpolates that temporary file's path into the test suite, and then runs the
test suite like `testNonXSDModelNegativeBadCompiledFile` does except this test
suite reloads the compiled parser successfully.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]