Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Add option to run on code blocks with custom annotations #27

Open
mattt opened this issue May 11, 2020 · 0 comments
Open

Add option to run on code blocks with custom annotations #27

mattt opened this issue May 11, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@mattt
Copy link
Contributor

mattt commented May 11, 2020

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, swift</code> and <code>. We should also probably make the delimiter fully configurable (support, for example, ```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"
@mattt mattt added the enhancement New feature or request label May 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant