test23.spec.js 599 B

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