-
Notifications
You must be signed in to change notification settings - Fork 21
/
compile.js
43 lines (23 loc) · 1014 Bytes
/
compile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* eslint-disable max-len */
import {describe} from 'ava-spec';
const jssm = require('../../../build/jssm.es5.js');
describe('compile/1', async _parse_it => {
describe('a->b;', async it => {
const a_to_b_str = `a->b;`;
it('doesn\'t throw', t => t.notThrows(() => { jssm.compile(jssm.parse(a_to_b_str)); }) );
});
describe('a->b->c;', async it => {
const a_to_b_to_c_str = `a->b->c;`;
it('doesn\'t throw', t => t.notThrows(() => { jssm.compile(jssm.parse(a_to_b_to_c_str)); }) );
});
describe('template tokens', async it => {
const a_through_e_token_str = `a->${'b'}->c->${'d'}->e;`;
it('doesn\'t throw', t => t.notThrows(() => { jssm.compile(jssm.parse(a_through_e_token_str)); }) );
});
});
describe('error catchery', async _parse_it => {
describe('unknown rule', async it => {
it('throws', t => t.throws( () => { jssm.compile( [{"key":"FAKE_RULE","from":"a","se":{"kind":"->","to":"b"}}] ); } ));
});
});
// stochable