Testing the validator, programmatically [message #633042] |
Fri, 15 October 2010 04:06  |
Eclipse User |
|
|
|
In chapter 5. Runtime Concepts, section Test Validators of the users guide, methods for testing the validator are described. Unfortunately, only method for building a model manually is described, but not how to use the "can ...use EMF's ResourceSet to load models from your hard disk" method.
Does someone have some example (code) for me how to do that?
Thanks!
|
|
|
|
|
Re: Testing the validator, programmatically [message #633800 is a reply to message #633509] |
Tue, 19 October 2010 09:35  |
Eclipse User |
|
|
|
Am 10/18/10 11:42 AM, schrieb Bodo:
> Hello Sven,
>
> I just tried to insert this code schnipsel, but in vain. 1st I got an
> error message with "CancelIndicator.NullImpl" I can't resolve. Either
> import from "org.eclipse.xtext.util" nor from
> "org.eclipse.xtext.validation" works!
Sorry, I think it's "new CancelIndicator.NullImpl()"
>
> BTW. where I have to place this code schnipsel? I added two classes
> under validation extending AbstractXtextTests and
> AbstractDeclarativeValidator as suggested by the user guide.
In your unit test.
If you extend AbstractXtextTests, then you can obtain a Resource for
your model (string literal) like this:
XtextResource myResource = getResource(new
StringInputStream("my.dsl(expression)"));
Sven
--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
|
|
|
Powered by
FUDForum. Page generated in 0.27464 seconds