test09.spec.js 592 B

12345678910111213141516171819202122232425
  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 outside 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. }
  15. pare
  16. }`;
  17. const lexer = Lexers['pt_br'];
  18. it(`should result in SyntaxError`, () => {
  19. const as = new IVProgParser(input, lexer);
  20. const fun = as.parseFunction.bind(as);
  21. expect(fun).toThrow();
  22. });
  23. });