test08.spec.js 687 B

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