tests for custom optimize option

pull/5370/head
aniket-engg 4 years ago
parent 8905c78b7e
commit 69a23378b6
  1. 11
      libs/remix-tests/src/compiler.ts
  2. 13
      libs/remix-tests/tests/testRunner.cli.spec.ts

@ -126,10 +126,11 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
async.waterfall([
function loadCompiler(next) {
compiler = new RemixCompiler()
if(compilerConfig) {
const {currentCompilerUrl, evmVersion, optimize, runs} = compilerConfig
evmVersion ? compiler.set('evmVersion', evmVersion) :
optimize ? compiler.set('optimize', optimize) :
runs ? compiler.set('runs', runs) : ''
evmVersion ? compiler.set('evmVersion', evmVersion) : null
optimize ? compiler.set('optimize', optimize) : null
runs ? compiler.set('runs', runs) : null
if(currentCompilerUrl) {
compiler.loadRemoteVersion(currentCompilerUrl)
compiler.event.register('compilerLoaded', this, function (version) {
@ -139,6 +140,10 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
compiler.onInternalCompilerLoaded()
next()
}
} else {
compiler.onInternalCompilerLoaded()
next()
}
},
function doCompilation(next) {
// @ts-ignore

@ -77,5 +77,18 @@ Commands:
// macth fail test details
expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/)
})
test('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')).toBeTruthy()
expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/)
expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../)
// match test result
expect(res.stdout.toString().trim()).toMatch(/Ok pass test/)
expect(res.stdout.toString().trim()).toMatch(/Ok fail test/)
// macth fail test details
expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/)
})
})
})
Loading…
Cancel
Save