test47.spec.js 750 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('The semantic analyser', function () {
  5. const code = `programa {
  6. funcao inicio() {
  7. inteiro a = 5
  8. real i = 8.5
  9. inteiro b[a][i];
  10. }
  11. }`;
  12. localStorage.setItem('ivprog.lang', 'pt');
  13. const lexer = LanguageService.getCurrentLexer();
  14. it(`should guarantee that array variable as dimensions are integers`, 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).toThrow();
  19. });
  20. });