|
|
|
@ -60,12 +60,12 @@ Commands: |
|
|
|
|
|
|
|
|
|
it('remix-tests running a test file', function() { |
|
|
|
|
const res = spawnSync(executablePath, [resolve(__dirname + '/examples_0/assert_ok_test.sol')]) |
|
|
|
|
console.log(res.stdout.toString()) |
|
|
|
|
// console.log(res.stdout.toString())
|
|
|
|
|
// match initial lines
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../) |
|
|
|
|
// match test result
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/AssertOkTest/gi) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/AssertOkTest/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/AssertOkTest okPassTest/) // check if console.log is printed
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok pass test/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/AssertOkTest okFailTest/) // check if console.log is printed
|
|
|
|
@ -79,88 +79,88 @@ Commands: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// it('remix-tests running a test file with custom compiler version', () => {
|
|
|
|
|
// const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
|
|
|
|
|
// // match initial lines
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('Compiler version set to 0.7.4. Latest version is')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('Loading remote solc version v0.7.4+commit.3f05b770 ...')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
|
|
|
|
|
// // match test result
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
|
|
|
|
|
// // match fail test details
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// it('remix-tests running a test file with unavailable custom compiler version (should fail)', () => {
|
|
|
|
|
// const res = spawnSync(executablePath, ['--compiler', '1.10.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
|
|
|
|
|
// // match initial lines
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('No compiler found in releases with version 1.10.4')
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// it('remix-tests running a test file with custom EVM', () => {
|
|
|
|
|
// const res = spawnSync(executablePath, ['--evm', 'petersburg', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
|
|
|
|
|
// // match initial lines
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('EVM set to petersburg')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
|
|
|
|
|
// // match test result
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
|
|
|
|
|
// // match fail test details
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// it('remix-tests running a test file by enabling optimization', () => {
|
|
|
|
|
// const res = spawnSync(executablePath, ['--optimize', 'true', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
|
|
|
|
|
// // match initial lines
|
|
|
|
|
// expect(res.stdout.toString().trim().includes('Optimization is enabled'))
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
|
|
|
|
|
// // match test result
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
|
|
|
|
|
// // match fail test details
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// it('remix-tests running a test file by enabling optimization and setting runs', () => {
|
|
|
|
|
// const res = spawnSync(executablePath, ['--optimize', 'true', '--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
|
|
|
|
|
// // match initial lines
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('Optimization is enabled')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('Runs set to 300')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
|
|
|
|
|
// // match test result
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
|
|
|
|
|
// // match fail test details
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// it('remix-tests running a test file without enabling optimization and setting runs (should fail)', () => {
|
|
|
|
|
// const res = spawnSync(executablePath, ['--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
|
|
|
|
|
// // match initial lines
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('Optimization should be enabled for runs')
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// it('remix-tests running a test file with all options', () => {
|
|
|
|
|
// const res = spawnSync(executablePath, ['--compiler', '0.7.5', '--evm', 'istanbul', '--optimize', 'true', '--runs', '250', resolve(__dirname + '/examples_0/assert_ok_test.sol')])
|
|
|
|
|
// // match initial lines
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('Compiler version set to 0.7.5. Latest version is')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('Loading remote solc version v0.7.5+commit.eb77ed08 ...')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('EVM set to istanbul')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('Optimization is enabled')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.contain('Runs set to 250')
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
|
|
|
|
|
// // match test result
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok pass test/)
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Ok fail test/)
|
|
|
|
|
// // match fail test details
|
|
|
|
|
// expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/)
|
|
|
|
|
// })
|
|
|
|
|
it('remix-tests running a test file with custom compiler version', () => { |
|
|
|
|
const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) |
|
|
|
|
// match initial lines
|
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('Compiler version set to 0.7.4. Latest version is') |
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('Loading remote solc version v0.7.4+commit.3f05b770 ...') |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../) |
|
|
|
|
// match test result
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok pass test/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok fail test/) |
|
|
|
|
// match fail test details
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('remix-tests running a test file with unavailable custom compiler version (should fail)', () => { |
|
|
|
|
const res = spawnSync(executablePath, ['--compiler', '1.10.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) |
|
|
|
|
// match initial lines
|
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('No compiler found in releases with version 1.10.4') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('remix-tests running a test file with custom EVM', () => { |
|
|
|
|
const res = spawnSync(executablePath, ['--evm', 'petersburg', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) |
|
|
|
|
// match initial lines
|
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('EVM set to petersburg') |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../) |
|
|
|
|
// match test result
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok pass test/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok fail test/) |
|
|
|
|
// match fail test details
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('remix-tests running a test file by enabling optimization', () => { |
|
|
|
|
const res = spawnSync(executablePath, ['--optimize', 'true', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) |
|
|
|
|
// match initial lines
|
|
|
|
|
expect(res.stdout.toString().trim().includes('Optimization is enabled')) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../) |
|
|
|
|
// match test result
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok pass test/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok fail test/) |
|
|
|
|
// match fail test details
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('remix-tests running a test file by enabling optimization and setting runs', () => { |
|
|
|
|
const res = spawnSync(executablePath, ['--optimize', 'true', '--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) |
|
|
|
|
// match initial lines
|
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('Optimization is enabled') |
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('Runs set to 300') |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../) |
|
|
|
|
// match test result
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok pass test/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok fail test/) |
|
|
|
|
// match fail test details
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('remix-tests running a test file without enabling optimization and setting runs (should fail)', () => { |
|
|
|
|
const res = spawnSync(executablePath, ['--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) |
|
|
|
|
// match initial lines
|
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('Optimization should be enabled for runs') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('remix-tests running a test file with all options', () => { |
|
|
|
|
const res = spawnSync(executablePath, ['--compiler', '0.7.5', '--evm', 'istanbul', '--optimize', 'true', '--runs', '250', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) |
|
|
|
|
// match initial lines
|
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('Compiler version set to 0.7.5. Latest version is') |
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('Loading remote solc version v0.7.5+commit.eb77ed08 ...') |
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('EVM set to istanbul') |
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('Optimization is enabled') |
|
|
|
|
expect(res.stdout.toString().trim()).to.contain('Runs set to 250') |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../) |
|
|
|
|
// match test result
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok pass test/) |
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Ok fail test/) |
|
|
|
|
// match fail test details
|
|
|
|
|
expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|