From d234397b4c2846af11ab25248dbccc13bd7a8a9a Mon Sep 17 00:00:00 2001 From: paulklint Date: Thu, 7 Mar 2024 20:35:04 +0100 Subject: [PATCH] Added missing rascalTypeConfig, might explain Jurgen's problems --- .../lang/rascalcore/check/RascalConfig.rsc | 2 +- .../check/tests/StaticTestingUtils.rsc | 2 +- .../lang/rascalcore/compile/Examples/Tst0.rsc | 92 +------------------ 3 files changed, 3 insertions(+), 93 deletions(-) diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/RascalConfig.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/RascalConfig.rsc index 0ab03230..c9dbcb91 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/RascalConfig.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/RascalConfig.rsc @@ -465,5 +465,5 @@ TypePalConfig rascalTypePalConfig( bool verbose = true, // for each compiled module, print PathConfig, module name and compilation time bool optimizeVisit = true, bool enableAsserts = true, - bool logWrittenFiles = false // print location of written files: .constants, .tpl, *.java + bool logWrittenFiles = true // print location of written files: .constants, .tpl, *.java ) = cconfig(); diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/tests/StaticTestingUtils.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/tests/StaticTestingUtils.rsc index 51613f4c..976beb9a 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/tests/StaticTestingUtils.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/tests/StaticTestingUtils.rsc @@ -64,7 +64,7 @@ set[Message] getAllMessages(ModuleStatus r) ModuleStatus checkStatements(str stmts, list[str] importedModules = [], list[str] initialDecls = []){ mloc = buildModule(stmts, importedModules=importedModules, initialDecls=initialDecls); - return rascalTModelForLocs([mloc], rascalTypePalConfig(), getRascalCompilerConfig(), dummy_compile1); + return rascalTModelForLocs([mloc], rascalTypePalConfig(rascalPathConfig = testingConfig()), getRascalCompilerConfig(), dummy_compile1); } bool check(str stmts, list[str] expected, list[str] importedModules = [], list[str] initialDecls = []){ diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Examples/Tst0.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Examples/Tst0.rsc index 36cb5f2a..f166bd58 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/compile/Examples/Tst0.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/compile/Examples/Tst0.rsc @@ -1,94 +1,4 @@ module lang::rascalcore::compile::Examples::Tst0 -import IO; -import lang::xml::IO; - -bool checkXMLResult(str input, node expected, bool fullyQualify = false) { - result = readXML(input, fullyQualify = fullyQualify); - if (result == expected) { - return true; - } - println("readXML failed"); - println("Expected: "); - iprintln(expected); - println("Got: "); - iprintln(result); - return false; -} - -str buildXML(str name, map[str, str] attrs = (), list[str] children = []) { - result = "\<"; - for (a <- attrs) { - result += " = \"\""; - } - result += "\>"; - for (c <- children) { - result += c; - } - return result + "\\>"; -} - - str fixColon(str attr) = visit(attr) { case /-/ => ":" }; - -test bool simpleXMLTest1() - = checkXMLResult(buildXML("xml"), "xml"()); - -test bool simpleXMLTest2() - = checkXMLResult(buildXML("xml", children = [ buildXML("a") ]), "xml"("a"())); - -test bool simpleXMLTest3() - = checkXMLResult(buildXML("xml", attrs = ("href" : "#42")), "xml"(href="#42")); - -test bool namespaceIgnored1() - = checkXMLResult(buildXML("table", attrs = ("xmlns" : "http://www.w3.org/TR/html4/")), "table"()); - -test bool namespaceIgnored2() - = checkXMLResult( - buildXML("table", attrs = ("xmlns-ht" : "http://www.w3.org/TR/html4/"), children=[ - buildXML("ht:tr") - ]), - "table"("tr"())); - -test bool namespaceIncluded() - = checkXMLResult( - buildXML("table", attrs = ("xmlns-ht" : "http://www.w3.org/TR/html4/"), children=[ - buildXML("ht-tr") - ]), - "table"("ht-tr"(), xmlns = ("ht": "http://www.w3.org/TR/html4/")), fullyQualify = true); - -test bool namespacesMultiple() - = checkXMLResult( - buildXML("table", attrs = ("xmlns-ht" : "http://www.w3.org/TR/html4/"), children=[ - buildXML("ht-tr"), - buildXML("tr", attrs = ("xmlns-ht2": "http://www.w3.org/TR/html5/")) - ]), - "table"( - "ht-tr"(), - "tr"(xmlns = ("ht2": "http://www.w3.org/TR/html5/")) - , xmlns = ("ht": "http://www.w3.org/TR/html4/") - ) - , fullyQualify = true); - - -test bool originTrackingElements() { - loc l = |std:///lang/rascal/tests/library/lang/xml/glossary.xml|; - return originTracking(readXML(l, trackOrigins=true), readFile(l)); -} - -test bool originTrackingElementsWithEndTags() { - loc l = |std:///lang/rascal/tests/library/lang/xml/glossary.xml|; - return originTracking(readXML(l, trackOrigins=true, includeEndTags=true), readFile(l)); -} - -private bool originTracking(node example, str content) { - poss = [ | /node x := example, x.line?]; // every node has a .src field, otherwise this fails with an exception - - for ( <- poss, p.offset?) { // some (top) nodes do not have offsets - assert content[p.offset] == "\<"; // all nodes start with a opening tag < - assert content[p.offset + p.length - 1] == "\>"; // all nodes end with a closing tag > - assert "" == line; - } - - return true; -} \ No newline at end of file +value main() = 42; \ No newline at end of file