test55.spec.js 708 B

12345678910111213141516171819202122232425
  1. import { IVProgParser } from './../js/ast/ivprogParser';
  2. import { SemanticAnalyser } from './../js/processor/semantic/semanticAnalyser';
  3. import { LanguageService } from '../js/services/languageService';
  4. describe('Math lib with no Lib mention ', function () {
  5. const code = `programa {
  6. funcao inicio() {
  7. real a = 1.0
  8. escreva(trocar_sinal(a))
  9. }
  10. }`;
  11. localStorage.setItem('ivprog.lang', 'pt');
  12. const lexer = LanguageService.getCurrentLexer();
  13. it(`should throw an exception`, function () {
  14. const parser = new IVProgParser(code, lexer);
  15. const sem = new SemanticAnalyser(parser.parseTree());
  16. const fun = sem.analyseTree.bind(sem);
  17. expect(fun).toThrow();
  18. });
  19. });