Files
xod/packages/xod-cli/test/transpile.spec.js
Evgeny Kochetkov e6ab08e297 chore(infra): format code with prettier
Just `yarn lint  --fix`
2018-03-05 17:59:03 +03:00

36 lines
988 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import fs from 'fs-extra';
import path from 'path';
import { assert } from 'chai';
import { exec } from 'child-process-promise';
import { rmrf } from 'xod-fs';
const tmpPath = subpath => path.resolve(__dirname, './tmp', subpath);
const xodc = path.resolve(__dirname, '../bin/xodc');
const wsPath = subpath =>
path.resolve(__dirname, '../../../workspace', subpath);
describe('xodc transpile', () => {
afterEach(() => rmrf(tmpPath('./')));
it('should transpile Blink project for Arduino', () =>
exec(
`node ${xodc} transpile --output=${tmpPath('blink.cpp')} ${wsPath(
'blink'
)} @/main`
)
.then(() =>
Promise.all([
fs.readFile(tmpPath('blink.cpp'), 'utf-8'),
fs.readFile(wsPath('blink/__fixtures__/arduino.cpp'), 'utf-8'),
])
)
.then(([actual, expected]) =>
assert.strictEqual(
actual,
expected,
'expected and actual C++ dont match'
)
));
});