Finish balance operator and add test for CameLIGO
This commit is contained in:
parent
759978393a
commit
7c291158c2
@ -751,6 +751,7 @@ module Typer = struct
|
|||||||
sender ;
|
sender ;
|
||||||
source ;
|
source ;
|
||||||
unit ;
|
unit ;
|
||||||
|
balance ;
|
||||||
amount ;
|
amount ;
|
||||||
transaction ;
|
transaction ;
|
||||||
get_contract ;
|
get_contract ;
|
||||||
@ -827,6 +828,7 @@ module Compiler = struct
|
|||||||
("ABS" , simple_unary @@ prim I_ABS) ;
|
("ABS" , simple_unary @@ prim I_ABS) ;
|
||||||
("CONS" , simple_binary @@ prim I_CONS) ;
|
("CONS" , simple_binary @@ prim I_CONS) ;
|
||||||
("UNIT" , simple_constant @@ prim I_UNIT) ;
|
("UNIT" , simple_constant @@ prim I_UNIT) ;
|
||||||
|
("BALANCE" , simple_constant @@ prim I_BALANCE) ;
|
||||||
("AMOUNT" , simple_constant @@ prim I_AMOUNT) ;
|
("AMOUNT" , simple_constant @@ prim I_AMOUNT) ;
|
||||||
("ADDRESS" , simple_constant @@ prim I_ADDRESS) ;
|
("ADDRESS" , simple_constant @@ prim I_ADDRESS) ;
|
||||||
("NOW" , simple_constant @@ prim I_NOW) ;
|
("NOW" , simple_constant @@ prim I_NOW) ;
|
||||||
|
17
src/test/contracts/balance_constant.mligo
Normal file
17
src/test/contracts/balance_constant.mligo
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
(**
|
||||||
|
|
||||||
|
This test makes sure that the balance is accessible in CameLIGO.
|
||||||
|
It's there to detect a regression of: https://gitlab.com/ligolang/ligo/issues/61
|
||||||
|
|
||||||
|
Which results in this error when you attempt to compile this contract:
|
||||||
|
|
||||||
|
generated. unrecognized constant: {"constant":"BALANCE","location":"generated"}
|
||||||
|
|
||||||
|
|
||||||
|
*)
|
||||||
|
|
||||||
|
type storage = tez
|
||||||
|
|
||||||
|
let main (p : unit) storage =
|
||||||
|
([] : operation list), balance
|
||||||
|
|
@ -1150,6 +1150,12 @@ let website2_mligo () : unit result =
|
|||||||
e_pair (e_typed_list [] t_operation) (e_int (op 42 n)) in
|
e_pair (e_typed_list [] t_operation) (e_int (op 42 n)) in
|
||||||
expect_eq_n program "main" make_input make_expected
|
expect_eq_n program "main" make_input make_expected
|
||||||
|
|
||||||
|
let balance_constant () : unit result =
|
||||||
|
let%bind program = mtype_file "./contracts/balance_constant.mligo" in
|
||||||
|
let input = e_tuple [e_unit () ; e_mutez 0] in
|
||||||
|
let expected = e_tuple [e_list []; e_mutez 4000000000000] in
|
||||||
|
expect_eq program "main" input expected
|
||||||
|
|
||||||
let main = test_suite "Integration (End to End)" [
|
let main = test_suite "Integration (End to End)" [
|
||||||
test "type alias" type_alias ;
|
test "type alias" type_alias ;
|
||||||
test "function" function_ ;
|
test "function" function_ ;
|
||||||
@ -1230,4 +1236,5 @@ let main = test_suite "Integration (End to End)" [
|
|||||||
test "website1 ligo" website1_ligo ;
|
test "website1 ligo" website1_ligo ;
|
||||||
test "website2 ligo" website2_ligo ;
|
test "website2 ligo" website2_ligo ;
|
||||||
test "website2 (mligo)" website2_mligo ;
|
test "website2 (mligo)" website2_mligo ;
|
||||||
|
test "balance constant (mligo)" balance_constant ;
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user