Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions test/lib/LibCodeGen.requireContractName.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ contract LibCodeGenRequireContractNameTest is Test {
this.callRequireContractName(name);
}

/// Rejection is asserted as the whole error, selector and argument: every
/// rejection below pins that the revert carries the name that was rejected,
/// so a build script that generates many files says which one it choked on.
function assertRejected(string memory name) internal {
vm.expectRevert(abi.encodeWithSelector(InvalidContractName.selector, name));
this.callRequireContractName(name);
Expand Down Expand Up @@ -119,13 +122,6 @@ contract LibCodeGenRequireContractNameTest is Test {
assertRejected(string(hex"466f6f00"));
}

/// The rejection carries the name that was rejected, so a build script that
/// generates many files says which one it choked on.
function testRequireContractNameErrorCarriesTheName() external {
vm.expectRevert(abi.encodeWithSelector(InvalidContractName.selector, "sub/Foo"));
this.callRequireContractName("sub/Foo");
}

/// Accepting a name is exactly accepting every one of its bytes, so an
/// accepted name can be rebuilt from the identifier alphabet and nothing
/// else. Fuzzed so that the check is not merely rejecting the handful of
Expand Down
Loading