JUnit test not using current validator [message #898637] |
Fri, 27 July 2012 00:22 |
Brad Riching Messages: 20 Registered: May 2012 |
Junior Member |
|
|
Hello,
I have a strange case where I open a new runtime instance of eclipse to test that my new validator check method is working, and it correctly reports the error. However, when I copy and paste the test case source from the eclipse runtime project, into a JUnit test case using external files of my model, the JUnit passes all tests. It's a copy and paste example (that is too huge to copy into this forum) so I have no idea why it wouldn't be working. It seems to me that the *.xtext.tests project is not aware that I made changes to the validator in the *.xtext project. Here's what I've tried:
- Restarting eclipse
- opening and closing projects
- Project -> clean
Here is the part of my validator that I just added to checkPortAssignWidth():
@Check(CheckType.FAST)
public void checkPortAssignWidth(PortAssign p) {
...
if (p.getConcatenation().isOpen()) {
EStructuralFeature f = PhdlPackage.Literals.CONCATENATION__OPEN;
error("Ports may not be open.", p.getConcatenation(), f, -1);
return;
}
...
}
The errors are properly reported in the editor UI (see attachment).
I am using eclipselabs/xtext-utils for unit testing.
Here's my testcase which incorrectly does not report any errors, but it should be reporting the same two errors as the editor:
@Test
def void test_atlys() {
ignoreFormattingDifferences();
var dir = "TestExamples/atlys/"
testFile(dir + "s6_devices.phdl", dir + "top.phdl")
}
When I remove the dependencies (the s6_devices.phdl file), top.phdl reports a bunch of linking errors. So I know the framework is actually parsing these files. I am stumped. Does the tests project depend on an actual plugin jar? If so, I have not made one yet of my DSL, so I'm unsure how it would be able to do anything at all if that were the case.
I currently have many other test cases that depend on the state of my validator, and although I had written the entire validator prior to writing THOSE testcases, they all seem to work. It's just that since I've updated my validator, the */xtext.tests project does not seem to be aware of those changes.
Anyone have any idea why my additional check I added to my validator isn't propagating over into the testing framework? (but somehow still is when I open up a runtime instance?)
-
Attachment: editor.png
(Size: 54.24KB, Downloaded 105 times)
|
|
|
|
Powered by
FUDForum. Page generated in 0.02906 seconds