test44.spec.js 699 B

1234567891011121314151617181920212223242526
  1. import { IVProgParser } from './../js/ast/ivprogParser';
  2. import { SemanticAnalyser } from './../js/processor/semantic/semanticAnalyser';
  3. import { LanguageService } from '../js/services/languageService';
  4. describe('A valid code', function () {
  5. const code = `programa {
  6. funcao inicio() {
  7. real a
  8. leia(a)
  9. a = a + 0xff
  10. }
  11. }`;
  12. localStorage.setItem('ivprog.lang', 'pt');
  13. const lexer = LanguageService.getCurrentLexer();
  14. it(`should not throw a semantic error`, function () {
  15. const parser = new IVProgParser(code, lexer);
  16. const sem = new SemanticAnalyser(parser.parseTree());
  17. const fun = sem.analyseTree.bind(sem);
  18. expect(fun).not.toThrow();
  19. });
  20. });