Passing SET_DELEGATE test for PascaLIGO

This commit is contained in:
John David Pressman 2019-12-17 09:34:05 -08:00
parent 20285f2b9e
commit fdeb95288d
3 changed files with 4 additions and 2 deletions

View File

@ -852,6 +852,7 @@ module Typer = struct
| C_ADDRESS -> ok @@ address ;
| C_SELF_ADDRESS -> ok @@ self_address;
| C_IMPLICIT_ACCOUNT -> ok @@ implicit_account;
| C_SET_DELEGATE -> ok @@ set_delegate ;
| _ -> simple_fail @@ Format.asprintf "Typer not implemented for consant %a" Stage_common.PP.constant c
@ -924,6 +925,7 @@ module Compiler = struct
| C_ADDRESS -> ok @@ simple_constant @@ prim I_ADDRESS
| C_SELF_ADDRESS -> ok @@ simple_constant @@ seq [prim I_SELF; prim I_ADDRESS]
| C_IMPLICIT_ACCOUNT -> ok @@ simple_unary @@ prim I_IMPLICIT_ACCOUNT
| C_SET_DELEGATE -> ok @@ simple_unary @@ prim I_SET_DELEGATE
| C_NOW -> ok @@ simple_constant @@ prim I_NOW
| C_CALL -> ok @@ simple_ternary @@ prim I_TRANSFER_TOKENS
| C_SOURCE -> ok @@ simple_constant @@ prim I_SOURCE

View File

@ -1,6 +1,6 @@
function main (const p: key_hash) : list(operation) is
begin
set_delegate(p) ;
const unused: operation = set_delegate(Some(p)) ;
const dummy: list(operation) = nil;
end with dummy

View File

@ -1761,7 +1761,7 @@ let set_delegate () : unit result =
let (raw_pkh,_,_) = Signature.generate_key () in
let pkh_str = Signature.Public_key_hash.to_b58check raw_pkh in
let%bind program = type_file "./contracts/set_delegate.ligo" in
let%bind () = expect_eq program "main" (e_string pkh_str) (e_typed_list [] t_operation)
let%bind () = expect_eq program "main" (e_key_hash pkh_str) (e_typed_list [] t_operation)
in ok ()
let main = test_suite "Integration (End to End)" [