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
structVisitor;implVisitMutforVisitor{fnvisit_mut_script(&mutself,script:&mutScript){// Do something with script}}
Then you create a unit test, something like
#[test]fntest_visitor(){let input = "";let expected = "";test_transform(Syntax::default(), |_| as_folder(&mutVisitor), input, expected,true);// Optionally do some assertions with assert, assert_eq etc on the visitor}
The test function won't work because the internal code for test_transform parses the input code as a module and not a script, so visit_mut_script is never called. Is there a different function to use instead of test_transform or is there a way to make test_transform use parse_script instead of parse_module?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Let's say you have a visitor, something like this
Then you create a unit test, something like
The test function won't work because the internal code for
test_transform
parses the input code as a module and not a script, sovisit_mut_script
is never called. Is there a different function to use instead oftest_transform
or is there a way to maketest_transform
useparse_script
instead ofparse_module
?Beta Was this translation helpful? Give feedback.
All reactions