File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ library stdError {
109109 bytes public constant indexOOBError = abi.encodeWithSignature ("Panic(uint256) " , 0x32 );
110110 bytes public constant memOverflowError = abi.encodeWithSignature ("Panic(uint256) " , 0x41 );
111111 bytes public constant zeroVarError = abi.encodeWithSignature ("Panic(uint256) " , 0x51 );
112+ bytes public constant lowLevelError = bytes ("" ); // `0x`
112113}
113114
114115struct StdStorage {
Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ contract StdErrorsTest is DSTest {
3838 test.enumConversion (1 );
3939 }
4040
41+ function testExpectEncodeStg () public {
42+ vm.expectRevert (stdError.encodeStorageError);
43+ test.encodeStgError ();
44+ }
45+
4146 function testExpectPop () public {
4247 vm.expectRevert (stdError.popError);
4348 test.pop ();
@@ -58,6 +63,11 @@ contract StdErrorsTest is DSTest {
5863 test.intern ();
5964 }
6065
66+ function testExpectLowLvl () public {
67+ vm.expectRevert (stdError.lowLevelError);
68+ test.someArr (0 );
69+ }
70+
6171 // TODO: figure out how to trigger encodeStorageError?
6272}
6373
@@ -66,7 +76,8 @@ contract ErrorsTest {
6676 T1
6777 }
6878
69- uint256 [] someArr;
79+ uint256 [] public someArr;
80+ bytes someBytes;
7081
7182 function assertionError () public pure {
7283 assert (false );
@@ -88,6 +99,13 @@ contract ErrorsTest {
8899 T (a);
89100 }
90101
102+ function encodeStgError () public {
103+ assembly {
104+ sstore (someBytes.slot, 1 )
105+ }
106+ bytes memory b = someBytes;
107+ }
108+
91109 function pop () public {
92110 someArr.pop ();
93111 }
You can’t perform that action at this time.
0 commit comments