File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -33,21 +33,28 @@ abstract contract StdAssertions {
33
33
event log_named_array (string key , int256 [] val );
34
34
event log_named_array (string key , address [] val );
35
35
36
+ bytes32 private constant FAILED_SLOT = bytes32 ("failed " );
37
+
36
38
bool private _failed;
37
39
38
40
function failed () public view returns (bool ) {
39
41
if (_failed) {
40
- return _failed ;
42
+ return true ;
41
43
} else {
42
- return vm.load (address (vm), bytes32 ( " failed " ) ) != bytes32 (0 );
44
+ return vm.load (address (vm), FAILED_SLOT ) != bytes32 (0 );
43
45
}
44
46
}
45
47
46
48
function fail () internal virtual {
47
- vm.store (address (vm), bytes32 ( " failed " ) , bytes32 (uint256 (1 )));
49
+ vm.store (address (vm), FAILED_SLOT , bytes32 (uint256 (1 )));
48
50
_failed = true ;
49
51
}
50
52
53
+ function fail (string memory message ) internal virtual {
54
+ fail ();
55
+ vm.assertTrue (false , message);
56
+ }
57
+
51
58
function assertTrue (bool data ) internal pure virtual {
52
59
if (! data) {
53
60
vm.assertTrue (data);
You can’t perform that action at this time.
0 commit comments