1
0

test19.spec.js 791 B

123456789101112131415161718192021222324252627
  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. import { LanguageService } from '../js/services/languageService';
  6. describe('Multi(*) operation', function () {
  7. let input = `programa {
  8. funcao inicio() {
  9. inteiro a
  10. a = -2 + 2 * 4 + 2
  11. }
  12. }`;
  13. const lexer = LanguageService.getCurrentLexer();
  14. it(`should have higher priority than Sum(+)`, function (done) {
  15. const parser = new IVProgParser(input, lexer);
  16. const exec = new IVProgProcessor(parser.parseTree());
  17. exec.interpretAST().then(sto => {
  18. expect(sto.applyStore('a').value).toEqual(8);
  19. done();
  20. }).catch( err => done(err));
  21. });
  22. });