test00.spec.js 901 B

12345678910111213141516171819202122232425262728
  1. import {
  2. IVProgParser
  3. } from './../js/ast/ivprogParser';
  4. import * as Expressions from './../js/ast/expressions/';
  5. import * as Commands from './../js/ast/commands/';
  6. import { LanguageService } from './../js/services/languageService';
  7. import { Types } from './../js/typeSystem/types';
  8. describe("Testing Syntax Analysis for default", () => {
  9. var input;
  10. const asa = {
  11. global: [new Commands.Declaration('PI', Types.REAL, new Expressions.IntLiteral(1), true),
  12. new Commands.ArrayDeclaration('a', Types.INTEGER, new Expressions.IntLiteral(5), new Expressions.IntLiteral(5), null, false)],
  13. functions: []
  14. };
  15. const lexer = LanguageService.getCurrentLexer();
  16. it("it should produce a valid AST", () => {
  17. input = `programa {
  18. const real PI = 1
  19. inteiro a[5][5]
  20. }`;
  21. const as = new IVProgParser(input, lexer);
  22. expect(as.parseTree()).not.toEqual(asa);
  23. });
  24. });