test02.spec.js 565 B

12345678910111213141516171819202122232425262728293031
  1. import Lexers from './../grammar/';
  2. import {
  3. IVProgParser
  4. } from './../js/ast/ivprogParser';
  5. import {
  6. SyntaxError}from './../js/ast/SyntaxError';
  7. describe('Legal newline syntax', () => {
  8. const input = `programa
  9. {
  10. const inteiro val = 5
  11. funcao p (
  12. inteiro a,
  13. inteiro b
  14. )
  15. {
  16. teste = a + b
  17. }
  18. }
  19. `;
  20. const lexer = Lexers['pt_br'];
  21. it(`should not result in SyntaxError`, () => {
  22. const as = new IVProgParser(input, lexer);
  23. const fun = as.parseTree.bind(as);
  24. expect(fun).not.toThrow();
  25. });
  26. });