Add more string tests to CameLIGO
This commit is contained in:
parent
0eb2b73afa
commit
8cfa583d55
@ -1,4 +1,10 @@
|
|||||||
(* Test that the string concatenation syntax in CameLIGO works *)
|
(* Test that the string concatenation syntax in CameLIGO works *)
|
||||||
|
|
||||||
|
let size_op (s : string) : nat =
|
||||||
|
String.size s
|
||||||
|
|
||||||
|
let slice_op (s : string) : string =
|
||||||
|
String.slice 1p 2p s
|
||||||
|
|
||||||
let concat_syntax (s: string) =
|
let concat_syntax (s: string) =
|
||||||
s ^ "test_literal"
|
s ^ "test_literal"
|
||||||
|
@ -239,6 +239,9 @@ let string_arithmetic () : unit result =
|
|||||||
|
|
||||||
let string_arithmetic_mligo () : unit result =
|
let string_arithmetic_mligo () : unit result =
|
||||||
let%bind program = mtype_file "./contracts/string_arithmetic.mligo" in
|
let%bind program = mtype_file "./contracts/string_arithmetic.mligo" in
|
||||||
|
let%bind () = expect_eq program "size_op" (e_string "tata") (e_nat 4) in
|
||||||
|
let%bind () = expect_eq program "slice_op" (e_string "tata") (e_string "at") in
|
||||||
|
let%bind () = expect_eq program "slice_op" (e_string "foo") (e_string "oo") in
|
||||||
let%bind () = expect_eq program "concat_syntax" (e_string "string_") (e_string "string_test_literal")
|
let%bind () = expect_eq program "concat_syntax" (e_string "string_") (e_string "string_test_literal")
|
||||||
in ok ()
|
in ok ()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user