test67.spec.js 943 B

1234567891011121314151617181920212223242526272829303132
  1. import { IVProgParser } from './../js/ast/ivprogParser';
  2. import { IVProgProcessor} from './../js/processor/ivprogProcessor'
  3. import { SemanticAnalyser } from "./../js/processor/semantic/semanticAnalyser";
  4. import { LanguageService } from '../js/services/languageService';
  5. describe('Command Do...While after the set timeout', function () {
  6. IVProgProcessor.LOOP_TIMEOUT = 500;
  7. let input = `programa {
  8. funcao inicio() {
  9. inteiro a = 0
  10. faca {
  11. a = a + 1
  12. } enquanto(1 < 4)
  13. }
  14. }`;
  15. const lexer = LanguageService.getCurrentLexer();
  16. it(`should be forcedly killed `, function (done) {
  17. const parser = new IVProgParser(input, lexer);
  18. const semantic = new SemanticAnalyser(parser.parseTree());
  19. const exec = new IVProgProcessor(semantic.analyseTree());
  20. exec.interpretAST().then(_ => {
  21. done("No error thrown");
  22. }).catch( _ => {
  23. expect(1).toEqual(1);
  24. done();
  25. });
  26. });
  27. });