Skip to content

Commit 16c2a04

Browse files
authored
Add test for multi-contract files with inheritance (#836)
1 parent ecd808c commit 16c2a04

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.7.0;
4+
5+
contract A {
6+
uint valA;
7+
8+
function setA() public {
9+
valA = 1;
10+
}
11+
}
12+
13+
contract B is A {
14+
uint valB;
15+
16+
function setB() public {
17+
valB = 1;
18+
}
19+
}
20+
21+
contract C is A {
22+
uint valC;
23+
24+
function setC() public {
25+
valC = 1;
26+
}
27+
}
28+
29+
contract D is B, C {
30+
uint valD;
31+
32+
function setD() public {
33+
valD = 1;
34+
}
35+
}

test/units/statements.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ describe('generic statements', () => {
6666
util.report(info.solcOutput.errors);
6767
})
6868

69+
it('should instrument a multi-contract file with diamond inheritance (#769)', () => {
70+
const info = util.instrumentAndCompile('statements/multi-contract-diamond');
71+
util.report(info.solcOutput.errors);
72+
});
73+
6974
it('should NOT pass tests if the contract has a compilation error', () => {
7075
const info = util.instrumentAndCompile('app/SimpleError');
7176
try {

0 commit comments

Comments
 (0)