Skip to content

Commit

Permalink
feat(objectionary#248): added 'tests' option to unphi command
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Mar 5, 2024
1 parent fce1ba6 commit 50b94aa
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion eo-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.35.3
0.35.6
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/commands/unphi.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = function(opts) {
[
`-Deo.unphiInputDir=${input}`,
`-Deo.unphiOutputDir=${output}`,
opts.tests ? '-Deo.unphiMetas=+tests' : ''
]
),
opts.target, opts.batch
Expand Down
3 changes: 2 additions & 1 deletion src/eoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,11 @@ program.command('phi')
});

program.command('unphi')
.option('--tests', 'Add "+tests" meta to result XMIR files')
.description('Generate XMIR files from PHI files')
.action((str, opts) => {
clear(str);
unphi(program.opts());
unphi({...program.opts(), ...str});
});

program.command('print')
Expand Down
1 change: 1 addition & 0 deletions test/commands/test_dataize.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const {runSync, parserVersion, homeHash} = require('../helpers');

const versions = new Map([
[parserVersion, homeHash],
['0.35.2', '130afdd1456a0cbafd52aee8d7bc612e1faac547'],
['0.35.1', '130afdd1456a0cbafd52aee8d7bc612e1faac547'],
['0.34.1', '1d605bd872f27494551e9dd2341b9413d0d96d89'],
]);
Expand Down
12 changes: 9 additions & 3 deletions test/commands/test_unphi.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
const fs = require('fs');
const path = require('path');
const {runSync, assertFilesExist, parserVersion, homeHash} = require('../helpers');
const assert = require('assert');

describe('unphi', function() {
it('converts PHI files to XMIR files', function(done) {
Expand All @@ -36,15 +37,20 @@ describe('unphi', function() {
'unphi',
'--verbose',
'--track-optimization-steps',
'--tests',
'--parser=' + parserVersion,
'--hash=' + homeHash,
'-t', path.resolve(home, 'target'),
]);
const unphied = 'target/unphi/app.xmir';
assertFilesExist(
stdout, home,
[
'target/unphi/app.xmir',
]
[unphied]
);
assert.ok(
fs.readFileSync(path.resolve(home, unphied)).toString().includes(
'<head>tests</head>'
)
);
done();
});
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// 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.2';
module.exports.parserVersion = '0.35.6';
module.exports.homeHash = '130afdd1456a0cbafd52aee8d7bc612e1faac547';

/**
Expand Down

0 comments on commit 50b94aa

Please sign in to comment.