test25.spec.js 721 B

12345678910111213141516171819202122232425
  1. import { IVProgParser } from './../js/ast/ivprogParser';
  2. import { IVProgProcessor} from './../js/processor/ivprogProcessor'
  3. import { LanguageService } from '../js/services/languageService';
  4. describe('Assigning an ID to another variable', function () {
  5. let input = `programa {
  6. funcao inicio() {
  7. inteiro a = 5
  8. inteiro b = a
  9. }
  10. }`;
  11. const lexer = LanguageService.getCurrentLexer();
  12. it(`should result in a valid state`, function (done) {
  13. const parser = new IVProgParser(input, lexer);
  14. const exec = new IVProgProcessor(parser.parseTree());
  15. exec.interpretAST().then(sto => {
  16. expect(sto.applyStore('b').value).toEqual(5);
  17. done();
  18. }).catch( err => done(err));
  19. });
  20. });