1
0

test23.spec.js 635 B

1234567891011121314151617181920212223242526
  1. import Lexers from './../grammar/';
  2. import {
  3. IVProgParser
  4. } from './../js/ast/ivprogParser';
  5. import { LanguageService } from '../js/services/languageService';
  6. describe('Variable initialization with a function call', () => {
  7. let input = `programa {
  8. funcao inicio() {
  9. inteiro a = func(5)
  10. }
  11. funcao inteiro fun(inteiro a) {
  12. retorne a * 2
  13. }
  14. }`;
  15. const lexer = LanguageService.getCurrentLexer();
  16. it(`should not throw an Error`, () => {
  17. const as = new IVProgParser(input, lexer);
  18. const fun = as.parseTree.bind(as);
  19. expect(fun).not.toThrow();
  20. });
  21. });