Skip to content

Add specific error substring assertions to negative tests in Upgrades.t.sol #1242

@coderabbitai

Description

@coderabbitai

Summary

The negative tests in packages/plugin-hardhat/test/solidity/Upgrades.t.sol (e.g., testValidateImplementation, testValidateLayout, testValidateLayoutUpgradesFrom, testValidateNamespaced, testValidateNamespacedUpgradesFrom, testValidateNamespacedNoReference) currently use bare catch {} blocks that accept any revert — including unrelated regressions — without verifying the revert reason.

Proposed Fix

Once stable error message substrings from the plugin are curated, replace each bare catch {} with a specific substring assertion using the already-imported StringFinder utility, e.g.:

} catch (bytes memory err) {
    assertTrue(string(err).contains("expected substring here"));
}

References

/cc @ericglau

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions