private void CheckFrameworkItems(string parentFile, string subFile, bool isSubsetOf) { Assert.IsTrue(File.Exists(parentFile), "PRE file was not found"); Assert.IsTrue(File.Exists(subFile), "POST file was not found"); // TODO: Fix this hack MessageEngine.ClearMessages(); var parser = new XmlToAstParserPhase("TestParser", _defaultXmlNamespace); var lowerer = new AstLowererPhase("TestLowerer"); var parentXmlIR = new XmlIR(); parentXmlIR.AddXml(parentFile, XmlIRDocumentType.Source, true); IIR parentParsed = parser.Execute(parentXmlIR); Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were parse errors in the PRE file."); // TODO: Fix this hack MessageEngine.ClearMessages(); var parentAstRootNode = ((AstIR)lowerer.Execute(parentParsed)).AstRootNode; Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were lowering errors in the PRE file."); // TODO: Fix this hack MessageEngine.ClearMessages(); var subXmlIR = new XmlIR(); subXmlIR.AddXml(subFile, XmlIRDocumentType.Source, true); IIR subParsed = parser.Execute(subXmlIR); Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were parse errors in the POST file."); // TODO: Fix this hack MessageEngine.ClearMessages(); var subAstRootNode = ((AstIR)lowerer.Execute(subParsed)).AstRootNode; Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were lowering errors in the POST file."); CheckFrameworkItems(parentAstRootNode, subAstRootNode, isSubsetOf); }
public void CheckFrameworkItemsNoLowering(string file) { Assert.IsTrue(File.Exists(file), "File was not found"); // TODO: Fix this hack MessageEngine.ClearMessages(); var parser = new XmlToAstParserPhase("TestParser", _defaultXmlNamespace); var lowerer = new AstLowererPhase("TestLowerer"); var unloweredXmlIR = new XmlIR(); unloweredXmlIR.AddXml(file, XmlIRDocumentType.Source, true); var unloweredAstRootNode = ((AstIR)parser.Execute(unloweredXmlIR)).AstRootNode; Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were parse errors in the unlowered file pass."); // TODO: Fix this hack MessageEngine.ClearMessages(); var loweredXmlIR = new XmlIR(); loweredXmlIR.AddXml(file, XmlIRDocumentType.Source, true); IIR loweredParsed = parser.Execute(loweredXmlIR); Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were parse errors in the lowered file pass."); // TODO: Fix this hack MessageEngine.ClearMessages(); var loweredAstRootNode = ((AstIR)lowerer.Execute(loweredParsed)).AstRootNode; Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were lowering errors in the file."); CheckFrameworkItems(unloweredAstRootNode, loweredAstRootNode, false); }