From 7d56385db1240d5d2888249523ba4a9f14423c37 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 21 Jan 2022 12:48:48 -0500 Subject: [PATCH] Add a doc test case for evaluating cases --- .../doc.md.files/syntax.u | 8 +++ .../transcripts-using-base/doc.output.md | 24 ++++++++ .../transcripts/bug-strange-closure.output.md | 55 +++++++++++++++++++ 3 files changed, 87 insertions(+) diff --git a/unison-src/transcripts-using-base/doc.md.files/syntax.u b/unison-src/transcripts-using-base/doc.md.files/syntax.u index a34ac8d50..3c77d0341 100644 --- a/unison-src/transcripts-using-base/doc.md.files/syntax.u +++ b/unison-src/transcripts-using-base/doc.md.files/syntax.u @@ -73,6 +73,14 @@ id x = x id (sqr 10) ``` +also: + +``` +match 1 with + 1 -> "hi" + _ -> "goodbye" +``` + To include a typechecked snippet of code without evaluating it, you can do: @typecheck ``` diff --git a/unison-src/transcripts-using-base/doc.output.md b/unison-src/transcripts-using-base/doc.output.md index d8699b61f..8af9f60d0 100644 --- a/unison-src/transcripts-using-base/doc.output.md +++ b/unison-src/transcripts-using-base/doc.output.md @@ -257,6 +257,14 @@ and the rendered output using `display`: id (sqr 10) ``` + also: + + ``` + match 1 with + 1 -> "hi" + _ -> "goodbye" + ``` + To include a typechecked snippet of code without evaluating it, you can do: @@ -281,6 +289,14 @@ and the rendered output using `display`: ⧨ 100 + also: + + match 1 with + 1 -> "hi" + _ -> "goodbye" + ⧨ + "hi" + To include a typechecked snippet of code without evaluating it, you can do: @@ -626,6 +642,14 @@ Lastly, it's common to build longer documents including subdocuments via `{{ sub ⧨ 100 + also: + + match 1 with + 1 -> "hi" + _ -> "goodbye" + ⧨ + "hi" + To include a typechecked snippet of code without evaluating it, you can do: diff --git a/unison-src/transcripts/bug-strange-closure.output.md b/unison-src/transcripts/bug-strange-closure.output.md index e8843d544..cc638d516 100644 --- a/unison-src/transcripts/bug-strange-closure.output.md +++ b/unison-src/transcripts/bug-strange-closure.output.md @@ -77,6 +77,14 @@ We can display the guide before and after adding it to the codebase: ⧨ 100 + also: + + match 1 with + 1 -> "hi" + _ -> "goodbye" + ⧨ + "hi" + To include a typechecked snippet of code without evaluating it, you can do: @@ -278,6 +286,14 @@ We can display the guide before and after adding it to the codebase: ⧨ 100 + also: + + match 1 with + 1 -> "hi" + _ -> "goodbye" + ⧨ + "hi" + To include a typechecked snippet of code without evaluating it, you can do: @@ -485,6 +501,14 @@ rendered = Pretty.get (docFormatConsole doc.guide) ⧨ 100 + also: + + match 1 with + 1 -> "hi" + _ -> "goodbye" + ⧨ + "hi" + To include a typechecked snippet of code without evaluating it, you can do: @@ -679,6 +703,14 @@ rendered = Pretty.get (docFormatConsole doc.guide) ⧨ 100 + also: + + match 1 with + 1 -> "hi" + _ -> "goodbye" + ⧨ + "hi" + To include a typechecked snippet of code without evaluating it, you can do: @@ -1795,6 +1827,29 @@ rendered = Pretty.get (docFormatConsole doc.guide) !Indent (!Lit (Right (Plain " "))) (!Lit (Right (Plain " "))) + (!Annotated.Group + (!Wrap + (!Lit (Right (Plain "also:"))))), + !Lit (Right (Plain "\n")), + !Lit (Right (Plain "\n")), + !Indent + (!Lit (Right (Plain " "))) + (!Lit (Right (Plain " "))) + (!Annotated.Group + (!Lit + (Left + (Eval + (Term.Term + (Any + (_ -> + (match 1 with + 1 -> "hi" + _ -> "goodbye")))))))), + !Lit (Right (Plain "\n")), + !Lit (Right (Plain "\n")), + !Indent + (!Lit (Right (Plain " "))) + (!Lit (Right (Plain " "))) (!Annotated.Group (!Wrap (!Annotated.Append