Completed
Branch master (945c66)
by Mathias
59s
created

Parser.spec.js ➔ ???   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
nc 1
dl 0
loc 27
rs 8.8571
cc 1
nop 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A Parser.spec.js ➔ ... ➔ ??? 0 9 1
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