From a9a9fd7d0b8bd895fb56c025ce6c921464074f2c Mon Sep 17 00:00:00 2001 From: Jacques Wagener Date: Fri, 8 Mar 2019 01:50:02 +0200 Subject: [PATCH] Add global string print test. --- tests/variables/test_print.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/variables/test_print.py b/tests/variables/test_print.py index 88ff7e6..e76fed8 100644 --- a/tests/variables/test_print.py +++ b/tests/variables/test_print.py @@ -39,3 +39,25 @@ def test(): c.functions.test().transact({"gas": 22000}) assert get_last_out(stdout) == '-123' + + +def test_print_string_from_storage(get_contract, get_last_out): + code = """ +car: public(string[64]) + +@public +def getCar() -> string[64]: + self.car = "My little car!" + vdb + return self.car + """ + + stdin = io.StringIO( + "self.car\n" + ) + stdout = io.StringIO() + + c = get_contract(code, stdin=stdin, stdout=stdout) + c.functions.getCar().call({"gas": 92000}) + + assert get_last_out(stdout) == "My little car!"