Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
This repository was 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

Description

@mattt

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions