expressionEOS.spec.js 640 B

12345678910111213141516171819202122
  1. import Lexers from './../grammar/';
  2. import {
  3. IVProgParser
  4. } from './../js/ast/ivprogParser';
  5. import {
  6. SyntaxError
  7. } from './../js/ast/SyntaxError';
  8. description('Expressions which ends with ID terminals:', () => {
  9. const input = 'test = i';
  10. const lexer = Lexers['pt_br'];
  11. it('\'val = i\' should not result in SyntaxError', () => {
  12. const as = new IVProgParser(input, lexer);
  13. expect(as.parseExpressionOR).not.toThrow(SyntaxError);
  14. });
  15. if("'val = 2 + vector[1]' should not result in SyntaxError", () => {
  16. const as = new IVProgParser(input, lexer);
  17. expect(as.parseExpressionOR).not.toThrow(SyntaxError);
  18. });
  19. });