From 06189ae57f2f556f21499938fca8f9c0db82779e Mon Sep 17 00:00:00 2001 From: Leonardo Alt Date: Mon, 19 Nov 2018 15:17:39 +0100 Subject: Add assert and tests for bound functions --- test/libsolidity/syntaxTests/bound/bound_all.sol | 10 ++++++++++ test/libsolidity/syntaxTests/bound/bound_call.sol | 7 +++++++ test/libsolidity/syntaxTests/bound/bound_no_call.sol | 7 +++++++ 3 files changed, 24 insertions(+) create mode 100644 test/libsolidity/syntaxTests/bound/bound_all.sol create mode 100644 test/libsolidity/syntaxTests/bound/bound_call.sol create mode 100644 test/libsolidity/syntaxTests/bound/bound_no_call.sol (limited to 'test/libsolidity/syntaxTests') diff --git a/test/libsolidity/syntaxTests/bound/bound_all.sol b/test/libsolidity/syntaxTests/bound/bound_all.sol new file mode 100644 index 00000000..29f55b88 --- /dev/null +++ b/test/libsolidity/syntaxTests/bound/bound_all.sol @@ -0,0 +1,10 @@ +library L { + function g(function() internal returns (uint) _t) internal returns (uint) { return _t(); } +} +contract C { + using L for *; + function f() public returns (uint) { + return t.g(); + } + function t() public pure returns (uint) { return 7; } +} diff --git a/test/libsolidity/syntaxTests/bound/bound_call.sol b/test/libsolidity/syntaxTests/bound/bound_call.sol new file mode 100644 index 00000000..281f19b4 --- /dev/null +++ b/test/libsolidity/syntaxTests/bound/bound_call.sol @@ -0,0 +1,7 @@ +library D { function double(uint self) internal pure returns (uint) { return 2*self; } } +contract C { + using D for uint; + function f(uint a) public pure { + a.double(); + } +} diff --git a/test/libsolidity/syntaxTests/bound/bound_no_call.sol b/test/libsolidity/syntaxTests/bound/bound_no_call.sol new file mode 100644 index 00000000..dcb3c3c5 --- /dev/null +++ b/test/libsolidity/syntaxTests/bound/bound_no_call.sol @@ -0,0 +1,7 @@ +library D { function double(uint self) public pure returns (uint) { return 2*self; } } +contract C { + using D for uint; + function f(uint a) public pure { + a.double; + } +} -- cgit