test10.spec.js 708 B

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