test25.spec.js 714 B

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