test08.spec.js 635 B

123456789101112131415161718192021222324252627
  1. import Lexers from './../grammar/';
  2. import {
  3. IVProgParser
  4. } from './../js/ast/ivprogParser';
  5. import {
  6. SyntaxError
  7. } from './../js/ast/SyntaxError';
  8. describe('Break command inside a loop', () => {
  9. let input = `funcao inteiro test(real i) {
  10. inteiro a = 5 + i
  11. a = 5 + G[i][6]
  12. enquanto (a > 5) {
  13. a = a + 1
  14. se (a == 3) {
  15. pare
  16. }
  17. }
  18. }`;
  19. const lexer = Lexers['pt_br'];
  20. it(`should not result in SyntaxError`, () => {
  21. const as = new IVProgParser(input, lexer);
  22. const fun = as.parseFunction.bind(as);
  23. expect(fun).not.toThrow();
  24. });
  25. });