Skip to content

Commit

Permalink
Merge pull request #210 from foundry-rs/dstest-imports
Browse files Browse the repository at this point in the history
fix: ds-test imports + compiler warnings
  • Loading branch information
mattsse authored Nov 4, 2022
2 parents 29028ca + 9bd7969 commit 5bafa16
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/StdAssertions.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.9.0;

import "../lib/ds-test/src/test.sol";
import "ds-test/test.sol";
import "./StdMath.sol";

abstract contract StdAssertions is DSTest {
Expand Down
30 changes: 15 additions & 15 deletions src/StdJson.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,63 @@ import "./Vm.sol";
library stdJson {
VmSafe private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));

function parseRaw(string memory json, string memory key) internal returns (bytes memory) {
function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) {
return vm.parseJson(json, key);
}

function readUint(string memory json, string memory key) internal returns (uint256) {
function readUint(string memory json, string memory key) internal pure returns (uint256) {
return abi.decode(vm.parseJson(json, key), (uint256));
}

function readUintArray(string memory json, string memory key) internal returns (uint256[] memory) {
function readUintArray(string memory json, string memory key) internal pure returns (uint256[] memory) {
return abi.decode(vm.parseJson(json, key), (uint256[]));
}

function readInt(string memory json, string memory key) internal returns (int256) {
function readInt(string memory json, string memory key) internal pure returns (int256) {
return abi.decode(vm.parseJson(json, key), (int256));
}

function readIntArray(string memory json, string memory key) internal returns (int256[] memory) {
function readIntArray(string memory json, string memory key) internal pure returns (int256[] memory) {
return abi.decode(vm.parseJson(json, key), (int256[]));
}

function readBytes32(string memory json, string memory key) internal returns (bytes32) {
function readBytes32(string memory json, string memory key) internal pure returns (bytes32) {
return abi.decode(vm.parseJson(json, key), (bytes32));
}

function readBytes32Array(string memory json, string memory key) internal returns (bytes32[] memory) {
function readBytes32Array(string memory json, string memory key) internal pure returns (bytes32[] memory) {
return abi.decode(vm.parseJson(json, key), (bytes32[]));
}

function readString(string memory json, string memory key) internal returns (string memory) {
function readString(string memory json, string memory key) internal pure returns (string memory) {
return abi.decode(vm.parseJson(json, key), (string));
}

function readStringArray(string memory json, string memory key) internal returns (string[] memory) {
function readStringArray(string memory json, string memory key) internal pure returns (string[] memory) {
return abi.decode(vm.parseJson(json, key), (string[]));
}

function readAddress(string memory json, string memory key) internal returns (address) {
function readAddress(string memory json, string memory key) internal pure returns (address) {
return abi.decode(vm.parseJson(json, key), (address));
}

function readAddressArray(string memory json, string memory key) internal returns (address[] memory) {
function readAddressArray(string memory json, string memory key) internal pure returns (address[] memory) {
return abi.decode(vm.parseJson(json, key), (address[]));
}

function readBool(string memory json, string memory key) internal returns (bool) {
function readBool(string memory json, string memory key) internal pure returns (bool) {
return abi.decode(vm.parseJson(json, key), (bool));
}

function readBoolArray(string memory json, string memory key) internal returns (bool[] memory) {
function readBoolArray(string memory json, string memory key) internal pure returns (bool[] memory) {
return abi.decode(vm.parseJson(json, key), (bool[]));
}

function readBytes(string memory json, string memory key) internal returns (bytes memory) {
function readBytes(string memory json, string memory key) internal pure returns (bytes memory) {
return abi.decode(vm.parseJson(json, key), (bytes));
}

function readBytesArray(string memory json, string memory key) internal returns (bytes[] memory) {
function readBytesArray(string memory json, string memory key) internal pure returns (bytes[] memory) {
return abi.decode(vm.parseJson(json, key), (bytes[]));
}
}
2 changes: 1 addition & 1 deletion src/Test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.6.2 <0.9.0;

import {CommonBase} from "./Common.sol";
import "../lib/ds-test/src/test.sol";
import "ds-test/test.sol";
// forgefmt: disable-next-line
import {console, console2, StdAssertions, StdCheats, stdError, stdJson, stdMath, StdStorage, stdStorage, StdUtils, Vm} from "./Components.sol";

Expand Down

0 comments on commit 5bafa16

Please sign in to comment.