Skip to content

Commit

Permalink
Underline red snippet output in no-color mode
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasVanPhan committed Apr 24, 2023
1 parent 501abb1 commit de08893
Show file tree
Hide file tree
Showing 45 changed files with 870 additions and 4 deletions.
7 changes: 7 additions & 0 deletions changelog/2547
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

author: nicolas.van.phan
description: "\\n\\nFor the following piece of code, with a string that has nothing to do here :\\n\\n\\n```\\nlet main {| I should be underlined in\\n error message with no-color and\\n I am a long message spreading\\n on 4 lines |} blah-blah\\n\\n```\\n\\n#### Before\\n\\n\\n```\\n> ligo compile contract --no-color contract.mligo\\nFile \"contract.mligo\", line 2, character 9 to line 5, character 15:\\n 1 | \\n 2 | let main {| I should be underlined in\\n 3 | error message with no-color and\\n 4 | I am a long message spreading\\n 5 | on 4 lines |} blah-blah\\nIll-formed value declaration.\\nAt this point, one of the following is expected:\\n * parameters as irrefutable patterns, e.g. variables, if defining a\\n function;\\n * the assignment symbol '=' followed by an expression;\\n * a type annotation starting with a colon ':';\\n * a comma ',' followed by another tuple component, if defining a\\n tuple.\\n\\n```\\n\\n#### After\\n\\n\\n```\\n> ligo compile contract --no-color contract.mligo\\nFile \"contract.mligo\", line 2, character 9 to line 5, character 15:\\n 1 | \\n 2 | let main {| I should be underlined in\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n 3 | error message with no-color and\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n 4 | I am a long message spreading\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n 5 | on 4 lines |} blah-blah\\n ^^^^^^^^^^^^^^^\\nIll-formed value declaration.\\nAt this point, one of the following is expected:\\n * parameters as irrefutable patterns, e.g. variables, if defining a\\n function;\\n * the assignment symbol '=' followed by an expression;\\n * a type annotation starting with a colon ':';\\n * a comma ',' followed by another tuple component, if defining a\\n tuple.\\n\\n```\\n\\n"
merge_request: '2547'
title: "Underline red snippet output in no-color mode"
type: added

48 changes: 48 additions & 0 deletions src/bin/expect_tests/annotated_michelson_record.ml

Large diffs are not rendered by default.

132 changes: 132 additions & 0 deletions src/bin/expect_tests/annotated_michelson_variant.ml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/bin/expect_tests/build_module_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ let%expect_test _ =
File "../../test/contracts/build/type_B.mligo", line 5, characters 5-6:
4 | \tlet s = s + 1 in
5 | \tlet p = p ^ "titi" in
^
6 | \t([] : operation list), s
:
Warning: unused variable "p".
Expand Down Expand Up @@ -201,5 +202,6 @@ let%expect_test _ =
File "../../test/contracts/build/module_scoping_bug.mligo", line 24, characters 8-13:
23 |
24 | let x = B.A.a
^^^^^

Module "B.A" not found. |}]
2 changes: 2 additions & 0 deletions src/bin/expect_tests/code_insertion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let%expect_test _ =
File "../../test/contracts/negative/bad_michelson_insertion_1.mligo", line 4, characters 29-72:
3 | let main (p : nat) (s : nat) : operation list * nat =
4 | let f : nat * nat -> nat = [%Michelson ({| ADD |} : nat * nat -> nat)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 | in [], f (p, s)

Raw Michelson must be seq (with curly braces {}), got: ADD. |test}]
Expand All @@ -24,6 +25,7 @@ let%expect_test _ =
File "../../test/contracts/negative/bad_michelson_insertion_2.mligo", line 5, characters 12-16:
4 | let f : nat -> nat -> nat = [%Michelson ({| ADD |} : nat -> nat -> nat)]
5 | in [], f (p, s)
^^^^

Invalid type(s)
Cannot unify "( nat * nat )" with "nat". |test}]
3 changes: 3 additions & 0 deletions src/bin/expect_tests/colour.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ let%expect_test _ =
File "../../test/contracts/negative/colour.mligo", line 6, characters 16-25:
5 | let main (p : unit) (s : storage) : return =
6 | let x : nat = 1 + 2 + 3 (* int *) in
^^^^^^^^^
7 | [],s

Invalid type(s)
Expand Down Expand Up @@ -85,6 +86,7 @@ let%expect_test _ =
File "../../test/contracts/negative/colour_test.mligo", line 3, characters 12-31:
2 | let test1 = Test.assert (1 = 1)
3 | let test2 = Test.assert (1 = 2)
^^^^^^^^^^^^^^^^^^^

Test failed with "failed assertion"
Trace:
Expand Down Expand Up @@ -124,6 +126,7 @@ let%expect_test _ =
File "../../test/contracts/negative/colour.mligo", line 6, characters 16-25:
5 | let main (p : unit) (s : storage) : return =
6 | let x : nat = 1 + 2 + 3 (* int *) in
^^^^^^^^^
7 | [],s

Invalid type(s)
Expand Down
Loading

0 comments on commit de08893

Please sign in to comment.