From 1a2a29bc03d2fecc3b19195a51222c750b8c6066 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Fri, 3 Jan 2020 17:46:31 +0100 Subject: [PATCH] negative timestamp literal test --- src/bin/expect_tests/contract_tests.ml | 4 ++++ src/test/contracts/bad_timestamp.ligo | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 src/test/contracts/bad_timestamp.ligo diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index 0ce94f98d..1ba33c139 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -936,3 +936,7 @@ let%expect_test _ = let%expect_test _ = run_ligo_bad [ "compile-contract" ; contract "bad_address_format.religo" ; "main" ] ; [%expect {| ligo: in file "bad_address_format.religo", line 2, characters 25-47. Badly formatted address "KT1badaddr": {"location":"in file \"bad_address_format.religo\", line 2, characters 25-47"} |}] + +let%expect_test _ = + run_ligo_bad [ "compile-contract" ; contract "bad_timestamp.ligo" ; "main" ] ; + [%expect {| ligo: in file "bad_timestamp.ligo", line 5, characters 29-43. Badly formatted timestamp "badtimestamp": {"location":"in file \"bad_timestamp.ligo\", line 5, characters 29-43"} |}] \ No newline at end of file diff --git a/src/test/contracts/bad_timestamp.ligo b/src/test/contracts/bad_timestamp.ligo new file mode 100644 index 000000000..42850560d --- /dev/null +++ b/src/test/contracts/bad_timestamp.ligo @@ -0,0 +1,7 @@ +type storage_ is timestamp + +function main(const p : unit; const s : storage_) : list(operation) * storage_ is + block { + var toto : timestamp := ("badtimestamp" : timestamp); + } + with ((nil: list(operation)), toto) \ No newline at end of file