Skip to content

Commit

Permalink
Test modified compile with multiple namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau committed Nov 20, 2023
1 parent 142c919 commit 537615b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
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 537615b

Please sign in to comment.