Total Complexity | 5 |
Complexity/F | 1 |
Lines of Code | 37 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | 'use strict'; |
||
2 | |||
3 | import * as fs from 'fs'; |
||
4 | import * as path from 'path'; |
||
5 | import { assert } from 'chai'; |
||
6 | import Parser from '../../src/Parser'; |
||
7 | import { Input, Lexer } from '../../src/Lexer'; |
||
8 | import pkg from '../../package.json'; |
||
9 | |||
10 | /** @test {Parser} */ |
||
11 | describe(`${pkg.name}/Parser/Parser`, () => { |
||
12 | /** @test {Parser#constructor} */ |
||
13 | describe('#constructor', () => { |
||
14 | it('Create a new instance of type Parser', () => { |
||
15 | const input = new Input('+Hello World'), |
||
16 | lexer = new Lexer(input), |
||
17 | parser = new Parser(lexer); |
||
18 | |||
19 | assert.instanceOf(parser, Parser); |
||
20 | }); |
||
21 | }); |
||
22 | |||
23 | /** @test {Parser#parse} */ |
||
24 | describe('#parse', () => { |
||
25 | it('Parse program', () => { |
||
26 | const code = fs.readFileSync(path.join(__dirname, '..', '..', 'example', 'hello_world.bot'), { |
||
27 | encoding : 'utf8', |
||
28 | flag : 'r' |
||
29 | }), |
||
30 | input = new Input(code), |
||
31 | lexer = new Lexer(input), |
||
32 | parser = new Parser(lexer); |
||
33 | |||
34 | assert.isObject(parser.parse()); |
||
35 | }); |
||
36 | }); |
||
37 | }); |
||
38 |