diff --git a/test/commands/test_assemble.js b/test/commands/test_assemble.js
index 5ac027b..0b379ee 100644
--- a/test/commands/test_assemble.js
+++ b/test/commands/test_assemble.js
@@ -25,7 +25,7 @@
const assert = require('assert');
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('assemble', function() {
it('assembles a simple .EO program', function(done) {
@@ -37,8 +37,8 @@ describe('assemble', function() {
'assemble',
'--verbose',
'--track-optimization-steps',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
diff --git a/test/commands/test_compile.js b/test/commands/test_compile.js
index aad07cc..46a1eb5 100644
--- a/test/commands/test_compile.js
+++ b/test/commands/test_compile.js
@@ -26,7 +26,7 @@ const rel = require('relative');
const assert = require('assert');
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('compile', function() {
it('compiles a simple .EO program into Java bytecode .class files', function(done) {
@@ -36,8 +36,8 @@ describe('compile', function() {
fs.writeFileSync(path.resolve(home, 'src/compile.eo'), simple('compile'));
const stdout = runSync([
'compile',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
@@ -73,8 +73,8 @@ describe('compile', function() {
const stdout = runSync([
'compile',
'--verbose',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
@@ -96,8 +96,8 @@ describe('compile', function() {
const stdout = runSync([
'compile',
'--clean',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
diff --git a/test/commands/test_dataize.js b/test/commands/test_dataize.js
index 056d195..1b6e019 100644
--- a/test/commands/test_dataize.js
+++ b/test/commands/test_dataize.js
@@ -26,36 +26,43 @@ const rel = require('relative');
const fs = require('fs');
const assert = require('assert');
const path = require('path');
-const {runSync} = require('../helpers');
+const {runSync, parserVersion, homeHash} = require('../helpers');
-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/foo/bar'), {recursive: true});
- fs.writeFileSync(
- path.resolve(home, 'src/foo/bar/simple.eo'),
- [
- '+package foo.bar',
- '+alias org.eolang.io.stdout',
- '',
- '[args] > simple',
- ' stdout "Hello, world!\\n" > @',
- ].join('\n')
- );
- const stdout = runSync([
- '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, world!'), stdout);
- assert(stdout.includes(`The directory ${rel(path.resolve(home, 'target'))} deleted`), stdout);
- assert(!fs.existsSync(path.resolve('../../mvnw/target')));
- done();
+const versions = new Map([
+ [parserVersion, homeHash],
+ ['0.34.1', '1d605bd872f27494551e9dd2341b9413d0d96d89'],
+]);
+versions.forEach(function (hash, version) {
+ describe('dataize', function() {
+ it('dataizes with ' + version, function(done) {
+ home = path.resolve('temp/test-dataize/' + version + '/simple');
+ 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'),
+ [
+ '+package foo.bar',
+ '+alias org.eolang.io.stdout',
+ '',
+ '[args] > simple',
+ ' stdout "Hello, world!\\n" > @',
+ ].join('\n')
+ );
+ const stdout = runSync([
+ 'dataize', 'foo.bar.simple',
+ '--verbose',
+ '--stack=64M',
+ '--clean',
+ '--parser=' + version,
+ '--hash=' + hash,
+ '-s', path.resolve(home, 'src'),
+ '-t', path.resolve(home, 'target'),
+ ]);
+ assert(stdout.includes('Hello, world!'), stdout);
+ assert(stdout.includes(`The directory ${rel(path.resolve(home, 'target'))} deleted`), stdout);
+ assert(!fs.existsSync(path.resolve('../../mvnw/target')));
+ done();
+ });
});
});
+
diff --git a/test/commands/test_link.js b/test/commands/test_link.js
index 46e4c83..e265aa4 100644
--- a/test/commands/test_link.js
+++ b/test/commands/test_link.js
@@ -25,7 +25,7 @@
const assert = require('assert');
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('link', function() {
it('compiles a simple .EO program into an executable .JAR', function(done) {
@@ -45,8 +45,8 @@ describe('link', function() {
const stdout = runSync([
'link',
'--verbose',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
diff --git a/test/commands/test_parse.js b/test/commands/test_parse.js
index 164cebd..4b09c9a 100644
--- a/test/commands/test_parse.js
+++ b/test/commands/test_parse.js
@@ -25,7 +25,7 @@
const assert = require('assert');
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('parse', function() {
it('parses a simple .EO program', function(done) {
@@ -36,8 +36,8 @@ describe('parse', function() {
const stdout = runSync([
'parse',
'--verbose',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
diff --git a/test/commands/test_phi.js b/test/commands/test_phi.js
index 3e2dd48..a134cdc 100644
--- a/test/commands/test_phi.js
+++ b/test/commands/test_phi.js
@@ -24,7 +24,7 @@
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('phi', function() {
it('converts XMIR files to PHI files', function(done) {
@@ -36,8 +36,8 @@ describe('phi', function() {
'phi',
'--verbose',
'--track-optimization-steps',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
diff --git a/test/commands/test_print.js b/test/commands/test_print.js
index fe3fcca..a02b816 100644
--- a/test/commands/test_print.js
+++ b/test/commands/test_print.js
@@ -24,7 +24,7 @@
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('print', function() {
it('converts XMIR files to EO files', function(done) {
@@ -33,14 +33,20 @@ describe('print', function() {
fs.mkdirSync(path.resolve(home, 'target/2-optimize'), {recursive: true});
fs.writeFileSync(
path.resolve(home, 'target/2-optimize/app.xmir'),
- ''
+ [
+ '',
+ '',
+ '',
+ ''
+ ].join(' ')
);
const stdout = runSync([
'print',
'--verbose',
'--track-optimization-steps',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-t', path.resolve(home, 'target'),
]);
assertFilesExist(
diff --git a/test/commands/test_test.js b/test/commands/test_test.js
index eb4f180..f73ab54 100644
--- a/test/commands/test_test.js
+++ b/test/commands/test_test.js
@@ -24,7 +24,7 @@
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('test', function() {
it('executes a single unit test', function(done) {
@@ -45,8 +45,8 @@ describe('test', function() {
const stdout = runSync([
'test',
'--verbose',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-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 b067abf..41d6eb6 100644
--- a/test/commands/test_transpile.js
+++ b/test/commands/test_transpile.js
@@ -24,7 +24,7 @@
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('transpile', function() {
it('transpiles a simple .EO program', function(done) {
@@ -35,8 +35,8 @@ describe('transpile', function() {
const stdout = runSync([
'transpile',
'--verbose',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
diff --git a/test/commands/test_unphi.js b/test/commands/test_unphi.js
index fb3d40d..d0b25d4 100644
--- a/test/commands/test_unphi.js
+++ b/test/commands/test_unphi.js
@@ -24,7 +24,7 @@
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('unphi', function() {
it('converts PHI files to XMIR files', function(done) {
@@ -36,8 +36,8 @@ describe('unphi', function() {
'unphi',
'--verbose',
'--track-optimization-steps',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-t', path.resolve(home, 'target'),
]);
assertFilesExist(
diff --git a/test/commands/test_verify.js b/test/commands/test_verify.js
index 4185e62..bcf8f34 100644
--- a/test/commands/test_verify.js
+++ b/test/commands/test_verify.js
@@ -25,7 +25,7 @@
const assert = require('assert');
const fs = require('fs');
const path = require('path');
-const {runSync, assertFilesExist} = require('../helpers');
+const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
describe('verify', function() {
it('verifies a simple .EO program', function(done) {
@@ -37,8 +37,8 @@ describe('verify', function() {
'verify',
'--verbose',
'--track-optimization-steps',
- '--parser=0.34.1',
- '--hash=1d605bd872f27494551e9dd2341b9413d0d96d89',
+ '--parser=' + parserVersion,
+ '--hash=' + homeHash,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
diff --git a/test/helpers.js b/test/helpers.js
index af37a52..07d9b32 100644
--- a/test/helpers.js
+++ b/test/helpers.js
@@ -22,6 +22,12 @@
* SOFTWARE.
*/
+// When you upgrade them, don't forget to place old values to the
+// "test_dataize.js" table of versions, in order to make sure we
+// do test dataization with all possible old versions.
+module.exports.parserVersion = '0.35.1';
+module.exports.homeHash = '130afdd1456a0cbafd52aee8d7bc612e1faac547';
+
/**
* Helper to run EOC command line tool.
*