Discussion:
[sonar-dev] How to unit test rules?
Francis Galiegue
2015-03-02 12:56:59 UTC
Permalink
Hello,

In spite of searching around the net for several days I still cannot
manage to do it...

Here I develop a grammar for an entirely new language (since I am used
to writing grammars, since I'm the developper of grappa, this part is
not a problem for me). I have a test grammar which works OK (checked
with sslr-toolkit's ToolKit), and have written a test rule.

But i cannot for the life of me find how to run unit tests for a given
input and a set of rules and check whether these rules are called and
the predicted output.

It seems to me that this is somewhere in sslr-test-harness but from
then on I'm stuck. How do I proceed?
--
Francis Galiegue, ***@gmail.com, https://github.com/fge
JSON Schema in Java: http://json-schema-validator.herokuapp.com
Parsers in pure Java: https://github.com/fge/grappa

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Dinesh Bolkensteyn
2015-03-02 13:02:10 UTC
Permalink
You'll have to look around a bit, also see the sources of some of our open
source plugins such as Java or Javascript to see how things are done there.

Now, you don't have to use SSLR to develop a language plugin for SonarQube.
If you prefer to write your parser with Grappa, then go for it.

The SonarQube platform offers API to get the list of files to analyze, to
create new issues on files at given lines, to save measures, and so on.

There is no restriction on the parsing technology.

Dinesh Bolkensteyn
www.SonarSource.com <http://www.sonarsource.com/>
twitter.com/DBolkensteyn <http://www.SonarSource.com>
Post by Francis Galiegue
Hello,
In spite of searching around the net for several days I still cannot
manage to do it...
Here I develop a grammar for an entirely new language (since I am used
to writing grammars, since I'm the developper of grappa, this part is
not a problem for me). I have a test grammar which works OK (checked
with sslr-toolkit's ToolKit), and have written a test rule.
But i cannot for the life of me find how to run unit tests for a given
input and a set of rules and check whether these rules are called and
the predicted output.
It seems to me that this is somewhere in sslr-test-harness but from
then on I'm stuck. How do I proceed?
--
JSON Schema in Java: http://json-schema-validator.herokuapp.com
Parsers in pure Java: https://github.com/fge/grappa
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Loading...