From fbcc38fc3c59d97d97653c62a3aec701daaac91d Mon Sep 17 00:00:00 2001 From: Whatmelon Date: Tue, 10 Dec 2024 20:23:34 +0800 Subject: [PATCH] Default commit message --- test/unit/RaffleTest.t.sol | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unit/RaffleTest.t.sol b/test/unit/RaffleTest.t.sol index 8b0402f..1b1f82a 100644 --- a/test/unit/RaffleTest.t.sol +++ b/test/unit/RaffleTest.t.sol @@ -332,4 +332,15 @@ contract ToolTest is Test { bytes.concat(bytes("1"), bytes("0"), bytes("0"), bytes("0")) ); } + + + //3way to get a function's selector (case1's 'this' can be replace to a instance of a contract); + function testEncoderWithSelector() public pure { + bytes4 output1 = this.testCastMultiFlag.selector; + bytes4 output2 = bytes4(keccak256("testCastMultiFlag()")); + bytes4 output3 = bytes4(abi.encodeWithSignature("testCastMultiFlag()")); + + assertEq(output1, output2); + assertEq(output3, output2); + } }