rust-analyzer / rowan

Apache License 2.0
677 stars 57 forks source link

Integration testing by implementing a toy language #141

Open MalteJanz opened 1 year ago

MalteJanz commented 1 year ago

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):

MalteJanz commented 1 year ago

@matklad what do you think about this?

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 commented 1 year ago

CC https://arzg.github.io/lang/, maybe we could lift that off as an example :-).

MalteJanz commented 1 year ago

@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 šŸ¤·ā€ā™‚ļø