Skip to content

Commit

Permalink
Test modified compile with multiple namespaces (#927)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau authored Nov 21, 2023
1 parent 142c919 commit 93c9e6f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
package:
- core
- plugin-hardhat
fail-fast: false

runs-on: ubuntu-latest

Expand Down
6 changes: 6 additions & 0 deletions packages/core/contracts/test/NamespacedToModify.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ contract Example {
uint256 y;
}

/// @custom:storage-location erc7201:example.secondary
struct SecondaryStorage {
uint256 a;
uint256 b;
}

/// @notice some natspec
function foo() public {}

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/utils/make-namespaced.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ async function testMakeNamespaced(
function normalizeStateVariableNames(input: SolcInput): void {
for (const source of Object.values(input.sources)) {
if (source.content !== undefined) {
source.content = source.content.replace(/\$MainStorage_\d{1,6};/g, '$MainStorage_random;');
source.content = source.content
.replace(/\$MainStorage_\d{1,6};/g, '$MainStorage_random;')
.replace(/\$SecondaryStorage_\d{1,6}/g, '$SecondaryStorage_random');
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/utils/make-namespaced.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Generated by [AVA](https://avajs.dev).
uint256 x;␊
uint256 y;␊
} MainStorage $MainStorage_random;␊
/// @custom:storage-location erc7201:example.secondary␊
struct SecondaryStorage {␊
uint256 a;␊
uint256 b;␊
} SecondaryStorage $SecondaryStorage_random;␊
Expand Down
Binary file modified packages/core/src/utils/make-namespaced.test.ts.snap
Binary file not shown.

0 comments on commit 93c9e6f

Please sign in to comment.