claytonrcarter / tree-sitter-phpdoc

PHPDoc grammar for tree-sitter
22 stars 11 forks source link

Reorganize tests into more categories #13

Closed mikehaertl closed 2 years ago

mikehaertl commented 2 years ago

An attempt to find a reasonable categorization that helps to avoid testing all thinkable permutations. E.g. most type combinations (list, array, ...) are now in types.txt. Whereas in typed_tags.txt I only used some exemplary complex types.

There may still be some untested edge cases though. Hopefully they fit into some category whenever we find them.

I also added some missing tags and fixed minor things in the grammar.

claytonrcarter commented 2 years ago

Maybe it's just me, but I have found tree-sitter tests w/ long sexp outputs difficult to debug when they fail, especially when the lists are highly repetetive. I don't have a strong sense of how long is too long, though. Maybe 10 if the parse output is simple lists of things like (tag (tag_name) (description (text))), and 5 if the parse output is more complex? I get that this means there's more test boilerplate needed, but I think the time/effort saved when something breaks is worth it, at least in my experience. Does that make sense?

Specifically, I'm looking at the phpunit and some of the typed_tags tests.

Other than that, this LGTM. Thank you!

mikehaertl commented 2 years ago

Maybe it's just me, ...

No, you're absolutely right. It was getting late and at the end I was in a rush to get things out. I've now split things up even more.

claytonrcarter commented 2 years ago

It was getting late and at the end I was in a rush to get things out.

I've been there before, too! Thanks @mikehaertl!