Small improvements to negative typer tests
This commit is contained in:
parent
f9daa64aa7
commit
f7616b7b49
@ -1,15 +1,19 @@
|
|||||||
open Cli_expect
|
open Cli_expect
|
||||||
|
|
||||||
let%expect_test _ =
|
let%expect_test _ =
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_1.mligo" ; "foo" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_1.mligo" ; "main" ] ;
|
||||||
[%expect {| ligo: in file "error_typer_1.mligo", line 3, characters 19-27. different type constructors: Expected these two constant type constructors to be the same, but they're different {"a":"string","b":"int"} |} ] ;
|
[%expect {| ligo: in file "error_typer_1.mligo", line 3, characters 19-27. different type constructors: Expected these two constant type constructors to be the same, but they're different {"a":"string","b":"int"} |} ] ;
|
||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_2.mligo" ; "foo" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_2.mligo" ; "main" ] ;
|
||||||
[%expect {| ligo: in file "error_typer_2.mligo", line 3, characters 24-39. different type constructors: Expected these two n-ary type constructors to be the same, but they're different {"a":"(TO_list(string))","b":"(TO_option(int))"} |} ] ;
|
[%expect {| ligo: in file "error_typer_2.mligo", line 3, characters 24-39. different type constructors: Expected these two n-ary type constructors to be the same, but they're different {"a":"(TO_list(string))","b":"(TO_option(int))"} |} ] ;
|
||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_3.mligo" ; "foo" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_3.mligo" ; "main" ] ;
|
||||||
[%expect {| ligo: in file "error_typer_3.mligo", line 3, characters 34-53. tuples have different sizes: Expected these two types to be the same, but they're different (both are tuples, but with a different number of arguments) {"a":"tuple[int , string , bool]","b":"tuple[int , string]"} |} ] ;
|
[%expect {| ligo: in file "error_typer_3.mligo", line 3, characters 34-53. tuples have different sizes: Expected these two types to be the same, but they're different (both are tuples, but with a different number of arguments) {"a":"tuple[int , string , bool]","b":"tuple[int , string]"} |} ] ;
|
||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_4.mligo" ; "foo" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_4.mligo" ; "main" ] ;
|
||||||
[%expect {| ligo: in file "error_typer_4.mligo", line 4, characters 17-56. different keys in record: {"key_a":"d","key_b":"c"} |} ] ;
|
[%expect {| ligo: in file "error_typer_4.mligo", line 4, characters 17-56. different keys in record: {"key_a":"d","key_b":"c"} |} ] ;
|
||||||
|
|
||||||
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_5.mligo" ; "main" ] ;
|
||||||
|
[%expect {| ligo: unbound type variable: {"variable":"boolean","in":"- E[]\tT[] ]","did_you_mean":"bool"} |} ] ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ module Errors = struct
|
|||||||
let suggestion = match name with
|
let suggestion = match name with
|
||||||
| "integer" -> "int"
|
| "integer" -> "int"
|
||||||
| "str" -> "string"
|
| "str" -> "string"
|
||||||
|
| "boolean" -> "bool"
|
||||||
| _ -> "no suggestion" in
|
| _ -> "no suggestion" in
|
||||||
let title = (thunk "unbound type variable") in
|
let title = (thunk "unbound type variable") in
|
||||||
let message () = "" in
|
let message () = "" in
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
type toto = int
|
type toto = int
|
||||||
|
|
||||||
let foo : string = 42 + 127
|
let foo : string = 42 + 127
|
||||||
|
|
||||||
|
let main (p:int) (storage : int) =
|
||||||
|
(([] : operation list) , p + foo)
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
type toto = int option
|
type toto = int option
|
||||||
|
|
||||||
let foo : string list = Some (42 + 127)
|
let foo : string list = Some (42 + 127)
|
||||||
|
|
||||||
|
let main (p:int) (storage : int) =
|
||||||
|
(([] : operation list) , p)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
let foo : integer = 3
|
let foo : boolean = 3
|
||||||
|
|
||||||
let main (p:int) (storage : int) =
|
let main (p:int) (storage : int) =
|
||||||
(([] : operation list) , p + foo)
|
(([] : operation list) , p + foo)
|
||||||
|
Loading…
Reference in New Issue
Block a user