Community
Participate
Working Groups
Version: Xtext 2.0 2011-03-14 Repeatable: always How to test: - clone project: https://github.com/cloudsmith/geppetto - checkout the following projects: org.cloudsmith.geppetto.pp.dsl.generate (the mwe2 workflow to generate the parser) org.cloudsmith.geppetto.pp.dsl.tests (Junit tests) org.cloudsmith.geppetto.pp.dsl.ui org.cloudsmith.geppetto.pp.dsl (the parser) org.cloudsmith.geppetto.pp (the model) - Run the jUnit test org.cloudsmith.geppetto.pp.dsl.tests.TestFailingSerialization.java, it contains 10 simple JUnit tests that are all failing (except 2 that illustrate a difference from a failing variant). The problems that can be observed: - linewrap rules not honoured - serialization (requested without formatting) when there is a node model formats and/or inserts text (These problems seems related to hidden() grammar rules, and if there are errors found in validation). I hope someone can look at these as these problems are preventing several of the intended use cases of the geppetto puppet "pp" manifest DSL.
ok, I'll take a look at this later this week.
(In reply to comment #1) > ok, I'll take a look at this later this week. Fantastic, we are trying to wrap up a release and do screen cams. Being able to include showing formatting as well would be awesome. Please let me know if I can help with anything (and ping me on IRC or Skype if needed).
Hi Hendrik, thanks a lot for the extensive test cases. They unveiled bug 341647, which I have fixed today. This turns 3 of your test cases green. I'll look at the others next week. regards, Moritz
Next unveiled and fixed bug in line: bug 341797 - [formatter] ElementMatcher: first parser rule call is not put on stack. 7 tests are green now, 3 to go.
TestFailingSerialization.test_Serialize_DqStringFollowedByDefine() failes because of: ---- Expected -- import "foo" define b { $a = 1 } ---------------- ---- Actual ---- import "foo" define b { $a = 1 } ---------------- you can fix this by removing the following statement form the FomattingConfig: --- c.setNoLinewrap().between(ga.getLiteralNameOrReferenceRule(), ga.getExpressionListRule()); --- The cause is that setNoLinewrap() has precedence over setLinewrap()
For TestFailingSerialization.test_Serialize_ManifestStatements(), the test fails with: ---- Expected ----- include 'a' a ------------------- ---- Actual ------- include 'a' a ------------------- This is because the parser actually parses three "ExpressionList"s. And therefore the formatting rule --- c.setLinewrap().after(ga.getPuppetManifestAccess().getStatementsAssignment_1()); --- kicks in. Since this issue is not formatting related, I'll leave it to you to fix this. It may be helpful to use NodeModelUtils in the TestCases --- XtextResource r = getResourceFromString(code); System.out.println(NodeModelUtils.compactDump(r.getParseResult().getRootNode(), false)); --- to find out what the parser actually reads.
The failure of TestFailingSerialization.test_Serialize_IfExpression1() is cause by: bug 341815 - "[serializer] NodeModel's nodes sometimes not correctly associated with ParseTreeConstructors tokens" Getting the tokens and nodes to play along is not really an issue I'd like to dive into, especially since bug 333976 - "[Serializer] replace backtracking algorithm with declarative approach" promises to fix that issue once and for all.
closing this bug since all issues directly related to formatting (except preserving formatting, but that will be handled by bug 341815) have been addressed. Henrik, I think you owe me a beer ;)
(In reply to comment #8) > closing this bug since all issues directly related to formatting (except > preserving formatting, but that will be handled by bug 341815) have been > addressed. > Thanks for the fixes, and the detective work. The compactDump was a good tip! > Henrik, I think you owe me a beer ;) Between you and Sebastian, I think I owe a case by now :) Cheers.