test05.spec.js 599 B

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