Skip to content

Commit

Permalink
chore: remove console2.log
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Jul 11, 2024
1 parent 0c7760a commit c5850be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions test/TinyENS.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract TinyENSTest is Test {
function setUp() public {
vm.startPrank(owner);
tinyENS = new TinyENS();
console2.log("TinyENS deployed");
console.log("TinyENS deployed");
vm.stopPrank();
}

Expand All @@ -25,17 +25,17 @@ contract TinyENSTest is Test {

assertEq(tinyENS.resolve("alice.eth"), alice);
assertEq(tinyENS.reverse(alice), "alice.eth");
console2.log("Alice registed alice.eth");
console.log("Alice registed alice.eth");
}

function test_RegisterAlreadyRegisteredName() public {
vm.startPrank(alice);
tinyENS.register("alice.eth");
assertEq(tinyENS.resolve("alice.eth"), alice);
assertEq(tinyENS.reverse(alice), "alice.eth");
console2.log("Alice registed alice.eth");
console.log("Alice registed alice.eth");

console2.log("Bob tries to register alice.eth");
console.log("Bob tries to register alice.eth");
vm.startPrank(bob);
vm.expectRevert(TinyENS.AlreadyRegistered.selector);
tinyENS.register("alice.eth");
Expand All @@ -50,25 +50,25 @@ contract TinyENSTest is Test {
tinyENS.register("alice.eth");
assertEq(tinyENS.resolve("alice.eth"), alice);
assertEq(tinyENS.reverse(alice), "alice.eth");
console2.log("Alice registed alice.eth");
console.log("Alice registed alice.eth");

tinyENS.register("alice22.eth");
assertEq(tinyENS.resolve("alice22.eth"), alice);
assertEq(tinyENS.reverse(alice), "alice22.eth");
console2.log("Alice updated its name to alice22.eth");
console.log("Alice updated its name to alice22.eth");
vm.stopPrank();
}

function test_UpdateWithAlreadyRegisteredName() public {
vm.startPrank(alice);
tinyENS.register("alice.eth");
console2.log("Alice registed alice.eth");
console.log("Alice registed alice.eth");

vm.startPrank(bob);
tinyENS.register("bob.eth");
console2.log("Bob registed bob.eth");
console.log("Bob registed bob.eth");

console2.log("Bob tries to update its name to alice.eth");
console.log("Bob tries to update its name to alice.eth");
vm.expectRevert(TinyENS.AlreadyRegistered.selector);
tinyENS.update("alice.eth");
assertEq(tinyENS.resolve("alice.eth"), alice);
Expand Down
20 changes: 10 additions & 10 deletions test/experiments/LastCallJackpot.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract LastCallJackpotTest is Test {
// Deploy contract.
vm.startPrank(owner);
lastCallJackpot = new LastCallJackpot{value: 1000 ether}();
console2.log("LastCallJackpot deployed");
console.log("LastCallJackpot deployed");
vm.stopPrank();
}

Expand All @@ -34,7 +34,7 @@ contract LastCallJackpotTest is Test {
assertEq(lastCallJackpot.lastCaller(), alice);
assertEq(address(lastCallJackpot).balance, 1001 ether);
assertEq(alice.balance, 999 ether);
console2.log("Alice calls the contract");
console.log("Alice calls the contract");
}

// This is another test to make sure that one can win the jackpot according to the rules.
Expand All @@ -50,11 +50,11 @@ contract LastCallJackpotTest is Test {
assertEq(lastCallJackpot.lastCaller(), alice);
assertEq(address(lastCallJackpot).balance, 1001 ether);
assertEq(alice.balance, 999 ether);
console2.log("Alice calls the contract");
console.log("Alice calls the contract");

// 10 blocks have passed without anyone calling the contract.
vm.roll(bn + 10);
console2.log("10 blocks have passed");
console.log("10 blocks have passed");

// Bob calls the contract and Alice wins the jackpot.
vm.startPrank(bob);
Expand All @@ -63,11 +63,11 @@ contract LastCallJackpotTest is Test {

assertEq(lastCallJackpot.lastBlock(), block.number);
assertEq(lastCallJackpot.lastCaller(), bob);
console2.log("Bob calls the contract");
console.log("Bob calls the contract");

assertEq(address(lastCallJackpot).balance, 0 ether);
assertEq(alice.balance, 999 ether + 1_001 ether + 1 ether);
console2.log("Alice wins the jackpot");
console.log("Alice wins the jackpot");
}

// This is another test to make sure that one can only win the jackpot if nobody called the contract for 10 blocks.
Expand All @@ -84,11 +84,11 @@ contract LastCallJackpotTest is Test {
assertEq(lastCallJackpot.lastCaller(), alice);
assertEq(address(lastCallJackpot).balance, 1001 ether);
assertEq(alice.balance, 999 ether);
console2.log("Alice calls the contract");
console.log("Alice calls the contract");

// 9 blocks have passed without anyone calling the contract.
vm.roll(bn + 9);
console2.log("9 blocks have passed");
console.log("9 blocks have passed");

// Bob calls the contract and nobody wins the jackpot.
vm.startPrank(bob);
Expand All @@ -99,7 +99,7 @@ contract LastCallJackpotTest is Test {
assertEq(lastCallJackpot.lastCaller(), bob);
assertEq(address(lastCallJackpot).balance, 1002 ether);
assertEq(bob.balance, 999 ether);
console2.log("Bob calls the contract");
console2.log("Nobody wins the jackpot");
console.log("Bob calls the contract");
console.log("Nobody wins the jackpot");
}
}

0 comments on commit c5850be

Please sign in to comment.