Skip to content

Commit

Permalink
Change solidity pragma versions in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mimi TxFusion committed Sep 7, 2023
1 parent 807d524 commit 43fa8f2
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;

library ChildChildLib {

function plus(uint a, uint b) public pure returns (uint) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;

import "./ChildChildLib.sol";
library ChildLib {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;

library DLib {

function multiply(uint a, uint b) public view returns (uint, address) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;

import "./ChildLib.sol";

library Math2Lib {

using ChildLib for uint;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;

import "./ChildLib.sol";

library MathLib {

using ChildLib for uint;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
pragma solidity >=0.7.0 <0.9.0;
pragma abicoder v2;

import "./MathLib.sol";

contract TestCoin {
Expand Down
15 changes: 15 additions & 0 deletions packages/hardhat-zksync-solc/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ describe('zksolc plugin', async function () {
useEnvironment('missing-libraries');

it('Should successfully identify all the missing libraries', async function () {
if (this.env.config.solidity.compilers[0].version.startsWith('0.4')) {
console.info(chalk.cyan('Test skipped since is not applicable to Solidity 0.4.x.'));
return;
}

await this.env.run(TASK_COMPILE);

// Assert that artifacts doesn't exist.
Expand Down Expand Up @@ -168,5 +173,15 @@ describe('zksolc plugin', async function () {
// Assert that list of missing libraries is correct.
assert.deepEqual(missingLibraries, expectedMissingLibraries);
});

afterEach(async function () {
if (this.env.config.solidity.compilers[0].version.startsWith('0.4')) {
console.info(chalk.cyan('Test skipped since is not applicable to Solidity 0.4.x.'));
return;
}

// Remove the file with the list of missing libraries.
fs.unlinkSync(this.env.config.zksolc.settings.missingLibrariesPath!);
});
});
});

0 comments on commit 43fa8f2

Please sign in to comment.