test38.spec.js 841 B

1234567891011121314151617181920212223242526272829
  1. import { IVProgParser } from './../js/ast/ivprogParser';
  2. import { IVProgProcessor} from './../js/processor/ivprogProcessor'
  3. import { OutputTest } from './../js/util/outputTest';
  4. import { LanguageService } from '../js/services/languageService';
  5. describe('The write function', function () {
  6. const code = `programa {
  7. funcao inicio() {
  8. real a = 8.01
  9. escreva(a)
  10. }
  11. }`;
  12. const output = new OutputTest();
  13. const lexer = LanguageService.getCurrentLexer();
  14. it(`should print the value passed to it, no matter it's type`, function (done) {
  15. const parser = new IVProgParser(code, lexer);
  16. const exec = new IVProgProcessor(parser.parseTree());
  17. exec.registerOutput(output);
  18. exec.interpretAST().then(sto => {
  19. expect(output.list).toEqual([8.01]);
  20. done();
  21. }).catch( err => done(err));
  22. });
  23. });