You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose I want to test a rule that parses variable names, but the top level of my file cannot have a variable name. Say variable names only appear four rules deep from the top level.
There isn't a straightforward way to do unit tests on just the variable name rule.
Something like
===
var name
===
foo = bar { baz ; fizz .
---
(fakelang
(term_declaration
(left_hand_side
(symbol
(var_name)))
(equals)
(rhs
(and so on))))
The problem is that this test would fail if the rules term_declaration, left_hand_side, symbol, equals, rhs, and so on were to fail. Even if I changed one of those names (say left_hand_side became lhs), it would break tests intended to test something completely unrelated.
It would be really nice if I could write an expected test result using something like
---
(fakelang
(* (var_name) *))
The motivation for this is that I have a lot of types of literals that I'd like to test the rules for, but the top level of my code can only be one of a few things, so all my literal tests are of the form
First, this gets wordy to test one rule. Second, the thing that actually has made testing a pain in the butt, is if I decide a totally unrelated rule, currently called wordy_id, shoudl isntead be called name, it breaks every test for literals even though it has nothing to do with the rules I'm testing.
The text was updated successfully, but these errors were encountered:
Suppose I want to test a rule that parses variable names, but the top level of my file cannot have a variable name. Say variable names only appear four rules deep from the top level.
There isn't a straightforward way to do unit tests on just the variable name rule.
Something like
The problem is that this test would fail if the rules
term_declaration
,left_hand_side
,symbol
,equals
,rhs
,and so on
were to fail. Even if I changed one of those names (sayleft_hand_side
becamelhs
), it would break tests intended to test something completely unrelated.It would be really nice if I could write an expected test result using something like
The motivation for this is that I have a lot of types of literals that I'd like to test the rules for, but the top level of my code can only be one of a few things, so all my literal tests are of the form
First, this gets wordy to test one rule. Second, the thing that actually has made testing a pain in the butt, is if I decide a totally unrelated rule, currently called
wordy_id
, shoudl isntead be calledname
, it breaks every test for literals even though it has nothing to do with the rules I'm testing.The text was updated successfully, but these errors were encountered: