Skip to content

Commit

Permalink
#360 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 30, 2024
1 parent 748cbee commit bdc5a50
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/eoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ program.command('phi')
.then((r) => coms().assemble(program.opts()))
.then((r) => coms().phi({...program.opts(), ...str}));
} else {
coms().phi(program.opts());
coms().phi({...program.opts(), ...str});
}
});

Expand Down
7 changes: 4 additions & 3 deletions test/commands/test_dataize.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ const {runSync, parserVersion, homeTag, weAreOnline} = require('../helpers');

const options = [
{lang: 'Java', version: parserVersion, tag: homeTag},
{lang: 'Java', version: '0.39.1', tag: 'f7a408498f099c4149626d18f8fe4462d3b35a67'},
{lang: 'Java', version: '0.38.0', tag: '3b5f3a5726a5d93ba6acb021a2be8a40e408a93f'},
{lang: 'Java', version: '0.36.0', tag: '8ce52371742c7ef249121b2a3cb39b3510aa5068'},
{lang: 'Java', version: '0.40.3', tag: '56b2f37d32d71f06e2d298325164485972197a06'},
{lang: 'Java', version: '0.39.1', tag: '0.39.1'},
{lang: 'Java', version: '0.38.0', tag: '0.38.0'},
{lang: 'Java', version: '0.36.0', tag: '0.36.0'},
{lang: 'JavaScript', version: parserVersion, tag: homeTag},
];

Expand Down
47 changes: 41 additions & 6 deletions test/commands/test_phi.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@

const fs = require('fs');
const path = require('path');
const {runSync, assertFilesExist, weAreOnline} = require('../helpers');
const {runSync, assertFilesExist, parserVersion, homeTag, weAreOnline} = require('../helpers');

describe('phi', function() {
before(weAreOnline);

it('converts XMIR files to PHI files', function(done) {
this.skip();
const home = path.resolve('temp/test-phi/simple');
fs.rmSync(home, {recursive: true, force: true});
fs.mkdirSync(path.resolve(home, 'src'), {recursive: true});
Expand All @@ -38,18 +39,52 @@ describe('phi', function() {
'phi',
'--verbose',
'--track-optimization-steps',
'--parser=0.38.3',
'--home-tag=4fab83ddc50b6aa86091f553cfb578df7d63a6be',
'--phi-input=2-optimize',
'--phi-output=output',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
'-s', path.resolve(home, 'src'),
'-t', path.resolve(home, 'target'),
]);
assertFilesExist(
stdout, home,
[
'target/2-optimize/phi.xmir',
'target/output/phi.phi',
'target/out/phi.phi',
]
);
done();
});

it('converts XMIR files to PHI files, in the ALONE mode', function(done) {
const home = path.resolve('temp/test-phi-alone/simple');
fs.rmSync(home, {recursive: true, force: true});
fs.mkdirSync(path.resolve(home, 'base/xmir'), {recursive: true});
fs.writeFileSync(
path.resolve(home, 'base/xmir/foo.xmir'),
'<program ms="1" name="foo" time="2024-01-01T01:01:01"' +
' version="1" revision="1" dob="2024-01-01T01:01:01">' +
' <listing/>' +
'<errors/>' +
'<sheets/>' +
'<license/>' +
'<metas/>' +
'<objects/>' +
'</program>'
);
const stdout = runSync([
'phi',
'--verbose',
'--track-optimization-steps',
`--parser=${parserVersion}`,
`--home-tag=${homeTag}`,
'--phi-input=xmir',
'--phi-output=phi',
'--alone',
'-t', path.resolve(home, 'base'),
]);
assertFilesExist(
stdout, home,
[
'base/phi/foo.phi'
]
);
done();
Expand Down
2 changes: 1 addition & 1 deletion test/commands/test_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('test', function() {

it('executes a single JavaScript unit test', function(done) {
const home = path.resolve('temp/test-test/javascript');
const stdout = test(home, 'JavaScript', '0.38.3', '4fab83ddc50b6aa86091f553cfb578df7d63a6be');
const stdout = test(home, 'JavaScript', '0.38.0', '0.38.0');
assert.ok(stdout.includes('1 passing'));
assertFilesExist(
stdout, home, ['target/project/simple-test.test.js',]
Expand Down

0 comments on commit bdc5a50

Please sign in to comment.