testDuplicateVariable.spec.js 574 B

12345678910111213141516171819202122
  1. import { IVProgParser } from './../js/ast/ivprogParser';
  2. import { LanguageService } from '../js/services/languageService';
  3. describe('A code with a duplicate variable declarations', function () {
  4. let input = `programa {
  5. funcao inicio() {
  6. real a = 90.0, a = 0.0
  7. escreva(Matematica.tan(a))
  8. }
  9. }`;
  10. const lexer = LanguageService.getCurrentLexer();
  11. it(`should throw a syntax exception`, function () {
  12. const parser = new IVProgParser(input, lexer);
  13. const func = parser.parseTree;
  14. func.bind(parser);
  15. expect(func).toThrow();
  16. });
  17. });