test08.spec.js 719 B

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