test52.spec.js 968 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. import { OutputTest } from '../js/util/outputTest';
  5. import { IVProgProcessor } from '../js/processor/ivprogProcessor';
  6. describe('A relational operation between strings ', function () {
  7. const code = `programa {
  8. funcao inicio() {
  9. cadeia a = "ABC", b = "DEF"
  10. logico c = a > b
  11. }
  12. }`;
  13. localStorage.setItem('ivprog.lang', 'pt');
  14. const lexer = LanguageService.getCurrentLexer();
  15. const out = new OutputTest();
  16. it(`should not throw an exception`, function (done) {
  17. const parser = new IVProgParser(code, lexer);
  18. const sem = new SemanticAnalyser(parser.parseTree());
  19. const exec = new IVProgProcessor(sem.analyseTree());
  20. exec.registerOutput(out);
  21. exec.interpretAST().then(_ => done()).catch(err => done(err));
  22. });
  23. });