Repository navigation
Conversation
Add documentation test support: - DocTest struct with parse() using typst-syntax LinkedNode AST - ID format path:function:number for doc test identification - Doc(DocTest) variant on Test enum with match arms everywhere - DocTestsConfig in ProjectConfig (enabled + sources) - Suite::collect_doc_tests() for discovery from .typ source files - DocTestRunner in runner.rs (compile-only, no comparison) - doc()/doc-tests() filter builtin, skip() updated for doc tests - JSON serialization, list display, and diagnostics reporting
The typst-syntax tree stores /// comments as trivia which are skipped by prev_sibling(). Switch to scanning source text backwards from the LetBinding node offset, stripping the leading # character. Also fix function detection to look for Closure children (not Ident+Params) which is how #let f(x)=... is parsed in typst-syntax.
…ollection Replace raw source text scanning with typst-ide-style sibling walking via LinkedNode::prev_sibling_with_trivia(), matching the approach used by typst-ide's internal Docs::collect_doc_comment(). Uses ast::LineComment casting for proper /// detection.
|
@tingerrr I'm just experimenting with how to implement doctests for Tytanic. Depending on how this turns out, this PR might be worth merging, but I wouldn't mind if it isn't. I noticed you're doing a fairly substantial refactor of the tests in #293. Does it make more sense for me to base this work on that branch, or should I wait until it's merged? |
|
I'm on phone right now so it's not easy to see. Did I already merge the empty doc test parts, i.e. just the identifier parsing and data types? If yes you should be able to base off of those, other wise I'd wait until those are merged and then base it off of those. But you can also explore the implementation here. What I left out in the changes to the internals was collection and evaluation. Collection is complicated because I don't think there's a clear cut answer to what is a doc test. Some prior work in this space would be tidy. Evaluation is the hardest part as it's unclear what should be available for a doc test to execute. I haven't done much research what packages do for either of this, I wanted to build a tool to more easily search across the whole universe, but that work stalled. |
|
Did you come to any conclusions here? I'm updating my work right now, and I'm wondering if there is work I can adopt. |
|
I'll take this as a no, feel free to re-open this if you get around to working on it again. |
Summary
See commit messages.
Related Issues
Checklist