Add option to run on code blocks with custom annotations #27
Description
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 annotated correctly. This should remain the default behavior.
It might be also useful to be able to run swift doctest
on unannotated code blocks. Although they wouldn't have annotations for expected output, they could be run through the REPL to check for errors.
Implementation-wise, we should support the most likely alternatives,
. We should also probably make the delimiter fully configurable (support, for example, swift</code> and <code>
```foo bar
).
Maybe something like the enumeration below:
enum CodeBlockFencedInfo {
case empty
case swift
case swiftDoctest
case custom(String)
}
...which would allow for each option to be enabled / disabled with a flag:
$ swift doctest --include-empty-fenced-info --no-include-swift-doctest-fenced-info --include-custom-fenched-info "foo bar"