1
0

test45.spec.js 731 B

1234567891011121314151617181920212223242526272829
  1. import { IVProgParser } from './../js/ast/ivprogParser';
  2. import { SemanticAnalyser } from './../js/processor/semantic/semanticAnalyser';
  3. import { LanguageService } from '../js/services/languageService';
  4. describe('The semantic analyser', function () {
  5. const code = `programa {
  6. funcao inicio() {
  7. real a;
  8. a = aNumber()
  9. }
  10. funcao inteiro aNumber () {
  11. retorne 3
  12. }
  13. }`;
  14. localStorage.setItem('ivprog.lang', 'pt');
  15. const lexer = LanguageService.getCurrentLexer();
  16. it(`should type check`, function () {
  17. const parser = new IVProgParser(code, lexer);
  18. const sem = new SemanticAnalyser(parser.parseTree());
  19. const fun = sem.analyseTree.bind(sem);
  20. expect(fun).toThrow();
  21. });
  22. });