3 ms·
For any token kind, it should be easy to come up with a minimal piece of syntax which includes that token. There is the problem, any tests that fail in the lex
by tonyedgecombe 6y ago
For any token kind, it should be easy to come up with a minimal piece of syntax which includes that token.
There is the problem, any tests that fail in the lexer now reach down through the parser to the lexer. The test is too far away from the point of failure. I'll now spend my time trying to understand a problem that would have been obvious when the lexer was being tested directly.
>Basically, treating the lexer part of a lexer/parser combo as public interface is rarely going to be a good idea.
This is part of the original point, the parser is the public interface which is why the OP was suggesting it should be the only contact point for the tests.
- kazinator 6y agoWhen a test fails, your understanding is informed by the nature of the code change that is responsible. If you keep code changes small, and keep tests working, you're good.