test01.spec.js 507 B

1234567891011121314151617181920212223242526
  1. import Lexers from './../grammar/';
  2. import {
  3. IVProgParser
  4. } from './../js/ast/ivprogParser';
  5. import {
  6. SyntaxError}from './../js/ast/SyntaxError';
  7. describe('Illegal newline syntax', () => {
  8. const input = `programa
  9. {
  10. const
  11. inteiro a = 1, b
  12. real
  13. PI = 5.6, c;
  14. }
  15. `;
  16. const lexer = Lexers['pt_br'];
  17. it(`should result in SyntaxError`, () => {
  18. const as = new IVProgParser(input, lexer);
  19. const fun = as.parseTree.bind(as);
  20. expect(fun).toThrow();
  21. });
  22. });