Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [xtext] testing the parser
[xtext] testing the parser [message #384429] Sun, 03 August 2008 13:29 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I've just started to take a look at this technology which looks really
cool, but I was wondering how to test the parser (I mean unit tests)...

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [xtext] testing the parser [message #384652 is a reply to message #384429] Fri, 08 August 2008 06:39 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
public void testSimple() throws Exception {
InputStream in = new StringInputStream("instance (of) { my dsl }");
Node rootNode = new XtextParser(model).getRootNode();
EObject modelElement = rootNode.getModelElement();
assert(....)
}

Note that it is a good idea to use EMF's generator in order to have
static types instead of using EMF's refelection layer for assertions.

Sven


Lorenzo Bettini schrieb:
> Hi
>
> I've just started to take a look at this technology which looks really
> cool, but I was wondering how to test the parser (I mean unit tests)...
>
> thanks in advance
> Lorenzo
>
Re: [xtext] testing the parser [message #384655 is a reply to message #384652] Fri, 08 August 2008 09:11 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Sven Efftinge wrote:
>
> public void testSimple() throws Exception {
> InputStream in = new StringInputStream("instance (of) { my dsl }");
> Node rootNode = new XtextParser(model).getRootNode();
> EObject modelElement = rootNode.getModelElement();
> assert(....)
> }
>
> Note that it is a good idea to use EMF's generator in order to have
> static types instead of using EMF's refelection layer for assertions.
>

mhh... sorry Sven, but I'm not sure I understand this part... I should
not use EObject right? Then what should I use?

thanks
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [xtext] testing the parser [message #618906 is a reply to message #384429] Fri, 08 August 2008 06:39 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
public void testSimple() throws Exception {
InputStream in = new StringInputStream("instance (of) { my dsl }");
Node rootNode = new XtextParser(model).getRootNode();
EObject modelElement = rootNode.getModelElement();
assert(....)
}

Note that it is a good idea to use EMF's generator in order to have
static types instead of using EMF's refelection layer for assertions.

Sven


Lorenzo Bettini schrieb:
> Hi
>
> I've just started to take a look at this technology which looks really
> cool, but I was wondering how to test the parser (I mean unit tests)...
>
> thanks in advance
> Lorenzo
>
Re: [xtext] testing the parser [message #618911 is a reply to message #384652] Fri, 08 August 2008 09:11 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Sven Efftinge wrote:
>
> public void testSimple() throws Exception {
> InputStream in = new StringInputStream("instance (of) { my dsl }");
> Node rootNode = new XtextParser(model).getRootNode();
> EObject modelElement = rootNode.getModelElement();
> assert(....)
> }
>
> Note that it is a good idea to use EMF's generator in order to have
> static types instead of using EMF's refelection layer for assertions.
>

mhh... sorry Sven, but I'm not sure I understand this part... I should
not use EObject right? Then what should I use?

thanks
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:how to put oaw projects on CVS
Next Topic:[xtext] How to use the generated ecore file?
Goto Forum:
  


Current Time: Thu Mar 28 09:01:17 GMT 2024

Powered by FUDForum. Page generated in 0.04086 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top