test10.spec.js 740 B

123456789101112131415161718192021222324252627282930
  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('IfThenElseIfThenElse command chain', () => {
  10. let input = `funcao inteiro test(real i) {
  11. inteiro a = 5 + i
  12. a = 5 + G[i][6]
  13. se (a > 5) {
  14. a = 5
  15. } senao se (a<5) {
  16. a = 0
  17. } senao {
  18. a = -1
  19. }
  20. }`;
  21. const lexer = LanguageService.getCurrentLexer();
  22. it(`should not result in SyntaxError`, () => {
  23. const as = new IVProgParser(input, lexer);
  24. const fun = as.parseFunction.bind(as);
  25. expect(fun).not.toThrow();
  26. });
  27. });