diff --git a/package.json b/package.json index bb1976b..86d965b 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,6 @@ "mocha": "10.2.0" }, "scripts": { - "test": "mocha --timeout 1200000" + "test": "mocha --timeout 1200000 --files test/**/*.js" } } diff --git a/src/commands/dataize.js b/src/commands/dataize.js index 1dd6d68..faaa0be 100644 --- a/src/commands/dataize.js +++ b/src/commands/dataize.js @@ -38,7 +38,7 @@ module.exports = function(obj, args, opts) { '-jar', path.resolve(opts.target, 'eoc.jar'), obj, ...args, - ] + ]; console.debug('+ java ' + params.join(' ')); spawn('java', params, {stdio: 'inherit'}).on('close', (code) => { if (code !== 0) { diff --git a/src/eoc.js b/src/eoc.js index 1aef6c3..097ba58 100755 --- a/src/eoc.js +++ b/src/eoc.js @@ -165,6 +165,7 @@ program.command('transpile') if (program.opts().alone == undefined) { register(program.opts()) .then((r) => assemble(program.opts())) + .then((r) => verify(program.opts())) .then((r) => transpile(program.opts())); } else { transpile(program.opts()); diff --git a/test/commands/test_assemble.js b/test/commands/test_assemble.js index 5f1f959..5ac027b 100644 --- a/test/commands/test_assemble.js +++ b/test/commands/test_assemble.js @@ -32,7 +32,7 @@ describe('assemble', function() { home = path.resolve('temp/test-assemble/simple'); fs.rmSync(home, {recursive: true, force: true}); fs.mkdirSync(path.resolve(home, 'src'), {recursive: true}); - fs.writeFileSync(path.resolve(home, 'src/simple.eo'), '[] > simple\n'); + fs.writeFileSync(path.resolve(home, 'src/assemble.eo'), '[] > assemble\n'); const stdout = runSync([ 'assemble', '--verbose', @@ -46,9 +46,9 @@ describe('assemble', function() { stdout, home, [ 'target/eo-foreign.json', - 'target/1-parse/simple.xmir', - 'target/2-optimization-steps/simple', - 'target/2-optimize/simple.xmir', + 'target/1-parse/assemble.xmir', + 'target/2-optimization-steps/assemble', + 'target/2-optimize/assemble.xmir', ] ); assert(!fs.existsSync(path.resolve('../../mvnw/target'))); diff --git a/test/commands/test_clean.js b/test/commands/test_clean.js index 8f64a2c..4c6ae7f 100644 --- a/test/commands/test_clean.js +++ b/test/commands/test_clean.js @@ -36,7 +36,7 @@ describe('clean', function() { fs.rmSync(eo, {recursive: true, force: true}); fs.mkdirSync(path.resolve(home, 'src'), {recursive: true}); fs.mkdirSync(eo, {recursive: true}); - fs.writeFileSync(path.resolve(home, 'src/simple.eo'), '[] > simple\n'); + fs.writeFileSync(path.resolve(home, 'src/clean.eo'), '[] > clean\n'); const stdout = runSync([ 'clean', '-s', path.resolve(home, 'src'), '-t', path.resolve(home, 'target'), '--cached', ]); diff --git a/test/commands/test_compile.js b/test/commands/test_compile.js index e9a01ac..a933e83 100644 --- a/test/commands/test_compile.js +++ b/test/commands/test_compile.js @@ -32,7 +32,7 @@ describe('compile', function() { home = path.resolve('temp/test-compile/simple'); fs.rmSync(home, {recursive: true, force: true}); fs.mkdirSync(path.resolve(home, 'src'), {recursive: true}); - fs.writeFileSync(path.resolve(home, 'src/simple.eo'), simple()); + fs.writeFileSync(path.resolve(home, 'src/compile.eo'), simple('compile')); const stdout = runSync([ 'compile', '--parser=0.34.1', @@ -43,9 +43,9 @@ describe('compile', function() { assertFilesExist( stdout, home, [ - 'target/generated-sources/EOfoo/EObar/EOapp.java', + 'target/generated-sources/EOfoo/EObar/EOcompile.java', 'target/generated-sources/EOorg/EOeolang/EObytes.java', - 'target/classes/EOfoo/EObar/EOapp.class', + 'target/classes/EOfoo/EObar/EOcompile.class', 'target/classes/org/eolang/Phi.class', 'target/classes/EOorg/EOeolang/EOint.class', ] @@ -59,12 +59,12 @@ describe('compile', function() { fs.rmSync(home, {recursive: true, force: true}); fs.mkdirSync(path.resolve(home, 'src'), {recursive: true}); fs.writeFileSync( - path.resolve(home, 'src/simple-test.eo'), + path.resolve(home, 'src/simple-test-compile.eo'), [ '+package foo.bar', '+junit', '', - '[] > simple-test', + '[] > simple-test-compile', ' TRUE > @', '', ].join('\n') @@ -80,8 +80,8 @@ describe('compile', function() { assertFilesExist( stdout, home, [ - 'target/generated-sources/EOfoo/EObar/EOsimple_testTest.java', - 'target/classes/EOfoo/EObar/EOsimple_testTest.class', + 'target/generated-sources/EOfoo/EObar/EOsimple_test_compileTest.java', + 'target/classes/EOfoo/EObar/EOsimple_test_compileTest.class', ] ); done(); @@ -91,7 +91,7 @@ describe('compile', function() { home = path.resolve('temp/test-compile/simple'); fs.rmSync(home, {recursive: true, force: true}); fs.mkdirSync(path.resolve(home, 'src'), {recursive: true}); - fs.writeFileSync(path.resolve(home, 'src/simple.eo'), simple()); + fs.writeFileSync(path.resolve(home, 'src/compile2.eo'), simple('compile2')); const stdout = runSync([ 'compile', '--clean', @@ -107,14 +107,15 @@ describe('compile', function() { /** * Creates simple correct eo program. + * @param {string} name - Name of object * @return {string} simple eo program */ -function simple() { +function simple(name) { return [ '+package foo.bar', '+alias org.eolang.io.stdout', '', - '[args] > app', + `[args] > ${name}`, ' stdout "Hello, world!" > @', ].join('\n'); } diff --git a/test/commands/test_link.js b/test/commands/test_link.js index f6feaa8..46e4c83 100644 --- a/test/commands/test_link.js +++ b/test/commands/test_link.js @@ -33,12 +33,12 @@ describe('link', function() { fs.rmSync(home, {recursive: true, force: true}); fs.mkdirSync(path.resolve(home, 'src/foo/bar'), {recursive: true}); fs.writeFileSync( - path.resolve(home, 'src/foo/bar/simple.eo'), + path.resolve(home, 'src/foo/bar/link.eo'), [ '+package foo.bar', '+alias org.eolang.io.stdout', '', - '[args] > app', + '[args] > link', ' stdout "Hello, world!" > @', ].join('\n') ); @@ -53,9 +53,9 @@ describe('link', function() { assertFilesExist( stdout, home, [ - 'target/generated-sources/EOfoo/EObar/EOapp.java', + 'target/generated-sources/EOfoo/EObar/EOlink.java', 'target/generated-sources/EOorg/EOeolang/EObytes.java', - 'target/classes/EOfoo/EObar/EOapp.class', + 'target/classes/EOfoo/EObar/EOlink.class', 'target/classes/org/eolang/Phi.class', 'target/classes/EOorg/EOeolang/EOint.class', 'target/eoc.jar', diff --git a/test/commands/test_transpile.js b/test/commands/test_transpile.js index 94b09b0..b067abf 100644 --- a/test/commands/test_transpile.js +++ b/test/commands/test_transpile.js @@ -28,19 +28,21 @@ const {runSync, assertFilesExist} = require('../helpers'); describe('transpile', function() { it('transpiles a simple .EO program', function(done) { - home = path.resolve('temp/test-transpile/simple'); + home = path.resolve('temp/test-transpile/transpile'); fs.rmSync(home, {recursive: true, force: true}); fs.mkdirSync(path.resolve(home, 'src'), {recursive: true}); - fs.writeFileSync(path.resolve(home, 'src/simple.eo'), '[] > simple\n'); + fs.writeFileSync(path.resolve(home, 'src/transpile.eo'), '[] > transpile\n'); const stdout = runSync([ 'transpile', '--verbose', + '--parser=0.34.1', + '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89', '-s', path.resolve(home, 'src'), '-t', path.resolve(home, 'target'), ]); assertFilesExist( stdout, home, - ['target/generated-sources/EOsimple.java'] + ['target/generated-sources/EOtranspile.java'] ); done(); }); diff --git a/test/commands/test_verify.js b/test/commands/test_verify.js index 5241e1e..4185e62 100644 --- a/test/commands/test_verify.js +++ b/test/commands/test_verify.js @@ -36,7 +36,6 @@ describe('verify', function() { const stdout = runSync([ 'verify', '--verbose', - '--debug', '--track-optimization-steps', '--parser=0.34.1', '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',