test13.spec.js 681 B

1234567891011121314151617181920212223242526272829
  1. import {
  2. IVProgParser
  3. } from './../js/ast/ivprogParser';
  4. import { LanguageService } from '../js/services/languageService';
  5. describe('A complete program code', () => {
  6. let input = `programa {
  7. const real PI = 5.7e-10
  8. inteiro V = -10*2
  9. funcao inteiro test(real i) {
  10. escolha (i) {
  11. caso 1:
  12. retorne 0
  13. caso contrario:
  14. retorne 4
  15. }
  16. }
  17. }`;
  18. const lexer = LanguageService.getCurrentLexer();
  19. it(`should not result in SyntaxError`, () => {
  20. const as = new IVProgParser(input, lexer);
  21. const fun = as.parseTree.bind(as);
  22. expect(fun).not.toThrow();
  23. });
  24. });