DocTest
DocTest copied to clipboard
An experimental tool for testing Swift example code in documentation.
This seems to be what I was seeing with #19. I have a very simple and freshly generated package: ``` Example/Package.swift Example/Sources/Example/Example.swift ``` `Example.swift` contains: ~~~swift /* ```swift doctest answer()...
As a general rule, you shouldn't run untrusted code. However, it would be helpful to either document or provide built-in functionality to run everything through `sandbox-exec(1)` on macOS. For example,...
I'd love to be able to just ```swift doctest .``` and have it run recursively on all swift files under my CWD.
Currently, `swift doctest` looks for any fenced code blocks starting with ```swift doctest (and soon with tildes, #23). By taking an opt-in approach, we can ensure that code expectations are...
As a big fan of python doctests I actually had a proof of concept swift doctest working a few years ago. I didn’t get much beyond proof of concept (although...
Currently, ``` is hard-coded into a regular expression pattern as the only delimiters for fenced code blocks. However, [according to the CommonMark Spec](https://spec.commonmark.org/0.29/#fenced-code-blocks): > ### 4.5 Fenced code blocks >...
Although [Mac Catalyst](https://developer.apple.com/mac-catalyst/) helps us get most of the way there, I suspect that there are some code examples that compile and run correctly on iOS, but would fail when...