Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Step by step test driven grammar development example. #7

Open
timoc opened this issue Jul 2, 2016 · 2 comments
Open

Request: Step by step test driven grammar development example. #7

timoc opened this issue Jul 2, 2016 · 2 comments

Comments

@timoc
Copy link

timoc commented Jul 2, 2016

I've been trying to work with spirit in a test driven development way, but i am finding it difficult to get any kind of process together. It is difficult to test rules in isolation, or in any structured way.

Can you extend this example to start building a grammar where you start building a an initial base test, and then build the rule to parse it. Then extend the test to another part of the grammar etc.

@djowel
Copy link
Contributor

djowel commented Jul 2, 2016

That's what I do, all the time actually, although it might not be evident in the examples I share because ultimately, what you see is the final code. I'm not sure if I can find some time to do an incremental "test driven" grammar development example, though I think it is a very good idea.

@timoc
Copy link
Author

timoc commented Jul 3, 2016

I tried to see if you did that in the git commits, but it was not evident.

Can i suggest, simply splitting them into separate folder which build separate binaries?
TDD would mean that they all compile, but half fail when you run make tests.
e.g.
\1-basic-grammar-test
\2-basic-grammar-rule+test
\3-extended-grammar-with-subrule-test
\3-extended-grammar-with-subrule+test
.....

Question:
I tried a TDD approach with gmock, but i had some difficulties. I was trying to break my grammar down into a set of separate sub-parsers that I could test individually, and give separate development cycles to. I had some real problems getting anything to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants