Followed docs at https://book.getfoundry.sh/reference/forge-std/console-log
Tests are passing but console.log is not doing anything. I excepted it would print the output in the terminal.
Test contract is as follows:
pragma solidity =0.8.17;
import "forge-std/console.sol";
import "forge-std/Test.sol";
contract ProjectTest is Test {
ProjectRouter router;
function setUp() public {
router = new ProjectRouter();
console.log("DONE"); // NOT WORKING
}
function test() public { // PASSED
string memory name = router.name();
assertEq(router.name(), "Router");
}
function test123() public { // PASSED
console.log(123); // NOT WORKING
}
}
Tried
contract ProjectTest is console, Test
But that gave more than 256 errors which look like this:
error[9097]: DeclarationError: Identifier already declared.
--> lib/forge-std/src/console.sol:2090:3:
|
2090 | function log(bool p0, bool p1, bool p2, uint p3) internal view {
| ^ (Relevant source part starts here and spans across multiple lines).
Note: The previous declaration is here:
--> lib/forge-std/lib/ds-test/src/test.sol:19:5:
|
19 | event log (string);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^