diff --git a/README.md b/README.md
index 4caa7eb..27faa06 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ Then, you write a simple [EO](https://www.eolang.org) program in `hello.eo` file
in the current directory:
```
-[args...] > hello
+[args] > hello
QQ.io.stdout > @
"Hello, world!\n"
```
diff --git a/eo-version.txt b/eo-version.txt
index 6b0ed1a..449c00d 100644
--- a/eo-version.txt
+++ b/eo-version.txt
@@ -1 +1 @@
-0.29.4
\ No newline at end of file
+0.34.1
\ No newline at end of file
diff --git a/itest/program.eo b/itest/program.eo
index 5f666a4..9c0625d 100644
--- a/itest/program.eo
+++ b/itest/program.eo
@@ -22,6 +22,6 @@
+alias story
-[args...] > program
+[args] > program
QQ.io.stdout > @
story
diff --git a/itest/story-test.eo b/itest/story-test.eo
index 123a02a..9186e10 100644
--- a/itest/story-test.eo
+++ b/itest/story-test.eo
@@ -21,11 +21,9 @@
# SOFTWARE.
+junit
-+alias org.eolang.hamcrest.assert-that
+alias story
-[] > story-is-long-enough
- assert-that > @
+[] > story-is-not-empty
+ gt. > @
story.length
- $.is
- $.greater-than 1
+ 0
diff --git a/itest/story.eo b/itest/story.eo
index 8ff582e..3cefdae 100644
--- a/itest/story.eo
+++ b/itest/story.eo
@@ -21,10 +21,4 @@
# SOFTWARE.
[] > story
- QQ.txt.sprintf > @
- "Hello, Mr. #%d!\n"
- as-int.
- QQ.math.number
- times.
- QQ.math.random.pseudo
- 100.0
+ "Hello, Jeff" > @
diff --git a/mvnw/pom.xml b/mvnw/pom.xml
index ecfd303..0c44b2b 100644
--- a/mvnw/pom.xml
+++ b/mvnw/pom.xml
@@ -24,11 +24,11 @@ SOFTWARE.
4.0.0
org.eolang
eoc
- 1.0-SNAPSHOT
+ 0.0.0
UTF-8
UTF-8
- 0.0.0
+ undefined
@@ -87,7 +87,7 @@ SOFTWARE.
maven-surefire-plugin
- 3.2.2
+ 3.2.3
true
diff --git a/package.json b/package.json
index bb1976b..6e6d413 100644
--- a/package.json
+++ b/package.json
@@ -38,7 +38,7 @@
"xmlhttprequest": "1.8.0"
},
"devDependencies": {
- "eslint": "8.55.0",
+ "eslint": "8.56.0",
"eslint-config-google": "0.14.0",
"grunt": "1.6.1",
"grunt-contrib-clean": "2.0.1",
@@ -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/assemble.js b/src/commands/assemble.js
index 786e714..f36dfc3 100644
--- a/src/commands/assemble.js
+++ b/src/commands/assemble.js
@@ -38,6 +38,7 @@ module.exports = function(opts) {
opts.verbose ? '--errors' : '',
opts.verbose ? '' : '--quiet',
opts.trackOptimizationSteps ? '-Deo.trackOptimizationSteps' : '',
+ opts.debug ? '--debug' : '',
`-Deo.targetDir=${path.resolve(opts.target)}`,
`-Deo.outputDir=${path.resolve(opts.target, 'classes')}`,
`-Deo.placed=${path.resolve(opts.target, 'eo-placed.csv')}`,
diff --git a/src/commands/compile.js b/src/commands/compile.js
index 0863b6c..909b0cf 100644
--- a/src/commands/compile.js
+++ b/src/commands/compile.js
@@ -36,11 +36,13 @@ module.exports = function(opts) {
'compiler:compile',
opts.verbose ? '--errors' : '',
opts.verbose ? '' : '--quiet',
+ opts.debug ? '--debug' : '',
`-Dmaven.compiler.source=1.8`,
`-Dmaven.compiler.target=1.8`,
`-Deo.targetDir=${target}`,
`-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`,
'-Deo.version=' + opts.parser,
+ '-Deo.hash=' + (opts.hash ? opts.hash : opts.parser),
], opts.target, opts.batch).then((r) => {
console.info('Java .class files compiled into %s', target);
return r;
diff --git a/src/commands/dataize.js b/src/commands/dataize.js
index ac8f830..faaa0be 100644
--- a/src/commands/dataize.js
+++ b/src/commands/dataize.js
@@ -32,15 +32,18 @@ const path = require('path');
* @param {Hash} opts - All options
*/
module.exports = function(obj, args, opts) {
- spawn(
- `java`,
- [
- '-Dfile.encoding=UTF-8',
- `-Xss${opts.stack}`,
- '-jar', path.resolve(opts.target, 'eoc.jar'),
- obj,
- ...args,
- ],
- {stdio: 'inherit'}
- );
+ const params = [
+ '-Dfile.encoding=UTF-8',
+ `-Xss${opts.stack}`,
+ '-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) {
+ console.error(`Java exited with #${code} code`);
+ process.exit(1);
+ }
+ });
};
diff --git a/src/commands/link.js b/src/commands/link.js
index 39e84fe..a5e4b72 100644
--- a/src/commands/link.js
+++ b/src/commands/link.js
@@ -35,6 +35,7 @@ module.exports = function(opts) {
'jar:jar',
opts.verbose ? '--errors' : '',
opts.verbose ? '' : '--quiet',
+ opts.debug ? '--debug' : '',
`-Deo.targetDir=${path.resolve(opts.target)}`,
'-Deo.version=' + opts.parser,
], opts.target, opts.batch).then((r) => {
diff --git a/src/commands/parse.js b/src/commands/parse.js
index f770827..724e9e3 100644
--- a/src/commands/parse.js
+++ b/src/commands/parse.js
@@ -37,6 +37,7 @@ module.exports = function(opts) {
'-Deo.hash=' + (opts.hash ? opts.hash : opts.parser),
opts.verbose ? '--errors' : '',
opts.verbose ? '' : '--quiet',
+ opts.debug ? '--debug' : '',
`-Deo.targetDir=${path.resolve(opts.target)}`,
`-Deo.outputDir=${path.resolve(opts.target, 'classes')}`,
], opts.target, opts.batch).then((r) => {
diff --git a/src/commands/register.js b/src/commands/register.js
index 45074a0..46ca83f 100644
--- a/src/commands/register.js
+++ b/src/commands/register.js
@@ -37,6 +37,7 @@ module.exports = function(opts) {
'-Deo.version=' + opts.parser,
opts.verbose ? '--errors' : '',
opts.verbose ? '' : '--quiet',
+ opts.debug ? '--debug' : '',
`-Deo.targetDir=${path.resolve(opts.target)}`,
`-Deo.sourcesDir=${path.resolve(opts.sources)}`,
], opts.target, opts.batch).then((r) => {
diff --git a/src/commands/sodg.js b/src/commands/sodg.js
index 77ff41b..abe7254 100644
--- a/src/commands/sodg.js
+++ b/src/commands/sodg.js
@@ -36,6 +36,7 @@ module.exports = function(opts) {
'-Deo.version=' + opts.parser,
opts.verbose ? '' : '--quiet',
opts.verbose ? '--errors' : '',
+ opts.debug ? '--debug' : '',
`-Deo.targetDir=${path.resolve(opts.target)}`,
];
argv.push('-Deo.sodgIncludes=' + opts.include);
diff --git a/src/commands/test.js b/src/commands/test.js
index 08c0487..30292eb 100644
--- a/src/commands/test.js
+++ b/src/commands/test.js
@@ -35,6 +35,7 @@ module.exports = function(opts) {
'surefire:test',
opts.verbose ? '--errors' : '',
opts.verbose ? '' : '--quiet',
+ opts.debug ? '--debug' : '',
'-Deo.version=' + opts.parser,
`-Deo.targetDir=${path.resolve(opts.target)}`,
]);
diff --git a/src/commands/transpile.js b/src/commands/transpile.js
index f4bc73f..59999de 100644
--- a/src/commands/transpile.js
+++ b/src/commands/transpile.js
@@ -37,6 +37,7 @@ module.exports = function(opts) {
'-Deo.version=' + opts.parser,
opts.verbose ? '--errors' : '',
opts.verbose ? '' : '--quiet',
+ opts.debug ? '--debug' : '',
`-Deo.targetDir=${path.resolve(opts.target)}`,
`-Deo.generatedDir=${sources}`,
], opts.target, opts.batch).then((r) => {
diff --git a/src/commands/verify.js b/src/commands/verify.js
new file mode 100644
index 0000000..9c3f529
--- /dev/null
+++ b/src/commands/verify.js
@@ -0,0 +1,47 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2022-2023 Objectionary.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+const path = require('path');
+const mvnw = require('../mvnw');
+
+/**
+ * Command to verify .XMIR files.
+ * @param {Hash} opts - All options
+ * @return {Promise} of assemble task
+ */
+module.exports = function(opts) {
+ return mvnw([
+ 'eo:verify',
+ '-Deo.version=' + opts.parser,
+ '-Deo.hash=' + (opts.hash ? opts.hash : opts.parser),
+ opts.verbose ? '--errors' : '',
+ opts.verbose ? '' : '--quiet',
+ opts.debug ? '--debug' : '',
+ `-Deo.targetDir=${path.resolve(opts.target)}`,
+ `-Deo.outputDir=${path.resolve(opts.target, 'classes')}`,
+ ], opts.target, opts.batch).then((r) => {
+ console.info('EO program verified in %s', path.resolve(opts.target));
+ return r;
+ });
+};
diff --git a/src/eoc.js b/src/eoc.js
index f863545..097ba58 100755
--- a/src/eoc.js
+++ b/src/eoc.js
@@ -31,6 +31,7 @@ const parse = require('./commands/parse');
const assemble = require('./commands/assemble');
const sodg = require('./commands/sodg');
const register = require('./commands/register');
+const verify = require('./commands/verify');
const transpile = require('./commands/transpile');
const compile = require('./commands/compile');
const link = require('./commands/link');
@@ -72,6 +73,7 @@ program
.option('--no-color', 'Disable colorization of console messages')
.option('--track-optimization-steps', 'Save intermediate XMIR files')
.option('-c, --clean', 'Delete ./.eoc directory')
+ .option('--debug', 'Print ALL debug messages, heavily overloading the log')
.option('--verbose', 'Print debug messages and full output of child processes');
program.command('audit')
@@ -143,6 +145,19 @@ program.command('sodg')
}
});
+program.command('verify')
+ .description('Verify XMIR files and fail if any issues inside')
+ .action((str, opts) => {
+ clear(str);
+ if (program.opts().alone == undefined) {
+ register(program.opts())
+ .then((r) => assemble(program.opts()))
+ .then((r) => verify(program.opts()));
+ } else {
+ verify(program.opts());
+ }
+ });
+
program.command('transpile')
.description('Convert EO files into target language')
.action((str, opts) => {
@@ -150,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());
@@ -163,6 +179,7 @@ program.command('compile')
if (program.opts().alone == undefined) {
register(program.opts())
.then((r) => assemble(program.opts()))
+ .then((r) => verify(program.opts()))
.then((r) => transpile(program.opts()))
.then((r) => compile(program.opts()));
} else {
@@ -177,6 +194,7 @@ program.command('link')
if (program.opts().alone == undefined) {
register(program.opts())
.then((r) => assemble(program.opts()))
+ .then((r) => verify(program.opts()))
.then((r) => transpile(program.opts()))
.then((r) => compile(program.opts()))
.then((r) => link(program.opts()));
@@ -193,6 +211,7 @@ program.command('dataize')
if (program.opts().alone == undefined) {
register(program.opts())
.then((r) => assemble(program.opts()))
+ .then((r) => verify(program.opts()))
.then((r) => transpile(program.opts()))
.then((r) => compile(program.opts()))
.then((r) => link(program.opts()))
@@ -209,6 +228,7 @@ program.command('test')
if (program.opts().alone == undefined) {
register(program.opts())
.then((r) => assemble(program.opts()))
+ .then((r) => verify(program.opts()))
.then((r) => transpile(program.opts()))
.then((r) => compile(program.opts()))
.then((r) => link(program.opts()))
diff --git a/test/commands/test_assemble.js b/test/commands/test_assemble.js
index cc34ab4..5ac027b 100644
--- a/test/commands/test_assemble.js
+++ b/test/commands/test_assemble.js
@@ -32,11 +32,13 @@ 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',
'--track-optimization-steps',
+ '--parser=0.34.1',
+ '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
@@ -44,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 24edd83..a933e83 100644
--- a/test/commands/test_compile.js
+++ b/test/commands/test_compile.js
@@ -32,16 +32,20 @@ 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', '-s', path.resolve(home, 'src'), '-t', path.resolve(home, 'target'),
+ 'compile',
+ '--parser=0.34.1',
+ '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '-s', path.resolve(home, 'src'),
+ '-t', path.resolve(home, 'target'),
]);
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',
]
@@ -55,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')
@@ -68,14 +72,16 @@ describe('compile', function() {
const stdout = runSync([
'compile',
'--verbose',
+ '--parser=0.34.1',
+ '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
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();
@@ -85,9 +91,14 @@ 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', '-s', path.resolve(home, 'src'), '-t', path.resolve(home, 'target'),
+ 'compile',
+ '--clean',
+ '--parser=0.34.1',
+ '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '-s', path.resolve(home, 'src'),
+ '-t', path.resolve(home, 'target'),
]);
assert(stdout.includes(`The directory ${path.resolve(home, 'target')} deleted`), stdout);
done();
@@ -96,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_dataize.js b/test/commands/test_dataize.js
index 16e67c8..21fa1a5 100644
--- a/test/commands/test_dataize.js
+++ b/test/commands/test_dataize.js
@@ -31,36 +31,28 @@ describe('dataize', function() {
it('runs a single executable .JAR and dataizes an object', function(done) {
home = path.resolve('temp/test-run/simple');
fs.rmSync(home, {recursive: true, force: true});
- fs.mkdirSync(path.resolve(home, 'src'), {recursive: true});
+ fs.mkdirSync(path.resolve(home, 'src/foo/bar'), {recursive: true});
fs.writeFileSync(
- path.resolve(home, 'src/simple.eo'),
+ path.resolve(home, 'src/foo/bar/simple.eo'),
[
'+package foo.bar',
'+alias org.eolang.io.stdout',
- '+alias org.eolang.txt.sprintf',
- '+alias org.eolang.collections.list',
'',
- '[args...] > app',
- ' seq > @',
- ' reduced.',
- ' list',
- ' * 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10',
- ' TRUE',
- ' [a x]',
- ' TRUE > @',
- ' stdout',
- ' sprintf "Hello, %s!" (args.at 0)',
+ '[args] > simple',
+ ' stdout "Hello, world!\\n" > @',
].join('\n')
);
const stdout = runSync([
- 'dataize', 'foo.bar.app', 'Jeff',
+ 'dataize', 'foo.bar.simple',
'--verbose',
'--stack=64M',
'--clean',
+ '--parser=0.34.1',
+ '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
- assert(stdout.includes('Hello, Jeff!'), stdout);
+ assert(stdout.includes('Hello, world!'), stdout);
assert(stdout.includes(`The directory ${path.resolve(home, 'target')} deleted`), stdout);
assert(!fs.existsSync(path.resolve('../../mvnw/target')));
done();
diff --git a/test/commands/test_foreign.js b/test/commands/test_foreign.js
index 6f23b3d..9139ff7 100644
--- a/test/commands/test_foreign.js
+++ b/test/commands/test_foreign.js
@@ -35,7 +35,7 @@ describe('foreign', function() {
fs.writeFileSync(
path.resolve(home, 'src/simple.eo'),
[
- '[args...] > app',
+ '[args] > app',
' QQ.io.stdout "Hello, world!" > @',
].join('\n')
);
diff --git a/test/commands/test_link.js b/test/commands/test_link.js
index 0ab2712..46e4c83 100644
--- a/test/commands/test_link.js
+++ b/test/commands/test_link.js
@@ -31,29 +31,31 @@ describe('link', function() {
it('compiles a simple .EO program into an executable .JAR', function(done) {
home = path.resolve('temp/test-link/simple');
fs.rmSync(home, {recursive: true, force: true});
- fs.mkdirSync(path.resolve(home, 'src'), {recursive: true});
+ fs.mkdirSync(path.resolve(home, 'src/foo/bar'), {recursive: true});
fs.writeFileSync(
- path.resolve(home, 'src/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')
);
const stdout = runSync([
'link',
'--verbose',
+ '--parser=0.34.1',
+ '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
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_parse.js b/test/commands/test_parse.js
index b84f38d..164cebd 100644
--- a/test/commands/test_parse.js
+++ b/test/commands/test_parse.js
@@ -36,6 +36,8 @@ describe('parse', function() {
const stdout = runSync([
'parse',
'--verbose',
+ '--parser=0.34.1',
+ '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
diff --git a/test/commands/test_test.js b/test/commands/test_test.js
index ea29d52..eb4f180 100644
--- a/test/commands/test_test.js
+++ b/test/commands/test_test.js
@@ -35,18 +35,18 @@ describe('test', function() {
path.resolve(home, 'src/simple-test.eo'),
[
'+junit',
- '+alias org.eolang.hamcrest.assert-that',
'',
'[] > simple-comparison-works',
- ' assert-that > @',
+ ' gt. > @',
' 10',
- ' $.greater-than',
- ' 5',
+ ' 5',
].join('\n')
);
const stdout = runSync([
'test',
'--verbose',
+ '--parser=0.34.1',
+ '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
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
new file mode 100644
index 0000000..4185e62
--- /dev/null
+++ b/test/commands/test_verify.js
@@ -0,0 +1,55 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2022-2023 Objectionary.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+const assert = require('assert');
+const fs = require('fs');
+const path = require('path');
+const {runSync, assertFilesExist} = require('../helpers');
+
+describe('verify', function() {
+ it('verifies a simple .EO program', function(done) {
+ home = path.resolve('temp/test-verify/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');
+ const stdout = runSync([
+ 'verify',
+ '--verbose',
+ '--track-optimization-steps',
+ '--parser=0.34.1',
+ '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '-s', path.resolve(home, 'src'),
+ '-t', path.resolve(home, 'target'),
+ ]);
+ assertFilesExist(
+ stdout, home,
+ [
+ 'target/2-optimize/simple.xmir',
+ 'target/6-verify/simple.xmir',
+ ]
+ );
+ assert(!fs.existsSync(path.resolve('../../mvnw/target')));
+ done();
+ });
+});