test40.spec.js 959 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 LanguageService', function () {
  6. beforeAll( () => {
  7. });
  8. afterAll(function () {
  9. });
  10. const code = `program {
  11. function start() {
  12. real a = 8.01
  13. write(a)
  14. }
  15. }`;
  16. const output = new OutputTest();
  17. LanguageService.setLang('en');
  18. const lexer = LanguageService.getCurrentLexer();
  19. it(`should provide the appropriate lexer`, function (done) {
  20. const parser = new IVProgParser(code, lexer);
  21. const exec = new IVProgProcessor(parser.parseTree());
  22. exec.registerOutput(output);
  23. exec.interpretAST().then(sto => {
  24. expect(output.list).toEqual([8.01]);
  25. LanguageService.setLang('pt');
  26. done();
  27. }).catch( err => done(err));
  28. });
  29. });