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
There should be a simple toy language and toy syntax tree to test all / most of the tree api methods (traversal and accessing specific nodes / tokens).
This issue tries to improve the testing situation in rowan, so things like #139 (off-by-one-error) can be caught at an early stage and projects depending on this library don't have to find these bugs the hard way. This should also allow for easier refactoring / internal changes with the confidence, that the public api still works as expected. Also future PRs which provide bug fixes for the public API can also provide a test for it to help increase the coverage.
steps to do this (out of my head / only a suggestion for the implementation):
Add a test directory for the integration tests
Write a module toy_language inside the test directory
Instead of writing a complete lexer / parser, simply write a method build_toy_tree which uses the GreenNodeBuilder and constructs a meaningful tree by hand (which provides enough depth / siblings / ... to use for testing)
Confirm the toy_language tree and underlaying source string looks like expected by writing two tests for this
Start implementing tests for the tree traversal / accessing tree nodes API
The text was updated successfully, but these errors were encountered:
MalteJanz
changed the title
Integration testing by implement a toy language
Integration testing by implementing a toy language
Sep 16, 2022
I may want to tackle this issue in the future, especially because I rely on the tree API and would like the confidence that it works as expected (and give back a bit to this awesome crate). But first I need to make some further progress on my bachelor project, so I will ping here if I start working on it ( if anybody else want's to tackle this before me, feel free) 🙂.
I guess it would be a great benefit to have some more tests for a crate which has over 1.2 million downloads and is used in more than 2200 GitHub repos (I guess that number is maybe a bit misleading now, that rust-analyzer is inside the rust-lang repo 😅 ).
@lnicola That's also a nice blog / resource which also helped me a ton with my implementation / usage of rowan 👍. Maybe it can also be added to the readme of rowan as a great learning resource? 🤔
I guess an implementation like that could also be used as a "toy language" but that is maybe already too big to only test some of the tree methods 🤷♂️
There should be a simple toy language and toy syntax tree to test all / most of the tree api methods (traversal and accessing specific nodes / tokens).
This issue tries to improve the testing situation in rowan, so things like #139 (off-by-one-error) can be caught at an early stage and projects depending on this library don't have to find these bugs the hard way. This should also allow for easier refactoring / internal changes with the confidence, that the public api still works as expected. Also future PRs which provide bug fixes for the public API can also provide a test for it to help increase the coverage.
steps to do this (out of my head / only a suggestion for the implementation):
test
directory for the integration teststoy_language
inside thetest
directorybuild_toy_tree
which uses theGreenNodeBuilder
and constructs a meaningful tree by hand (which provides enough depth / siblings / ... to use for testing)toy_language
tree and underlaying source string looks like expected by writing two tests for thisThe text was updated successfully, but these errors were encountered: