From 6b9615f57898b2ffe9ef78231a5534d97da45708 Mon Sep 17 00:00:00 2001 From: jkohnlein Date: Fri, 4 Jul 2008 11:35:53 +0000 Subject: [PATCH] Refactored parser: - Don't hand in currentNode in createLeafNode - Hand lexer errors through --- .../xtext/parsetree/InvalidTokenTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/InvalidTokenTest.java diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/InvalidTokenTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/InvalidTokenTest.java new file mode 100644 index 000000000..df56726c7 --- /dev/null +++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/InvalidTokenTest.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + *******************************************************************************/ +package org.eclipse.xtext.parsetree; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.xtext.testlanguages.OptionalEmptyLanguageStandaloneSetup; +import org.eclipse.xtext.tests.AbstractGeneratorTest; + +/** + * @author Jan Köhnlein - Initial contribution and API + * + */ +public class InvalidTokenTest extends AbstractGeneratorTest { + + public void testInvalidTokenError() throws Exception { + with(OptionalEmptyLanguageStandaloneSetup.class); + CompositeNode rootNode = getRootNode("/*"); + EList allSyntaxErrors = rootNode.allSyntaxErrors(); + assertFalse(allSyntaxErrors.isEmpty()); + SyntaxError syntaxError = allSyntaxErrors.get(0); + assertTrue(syntaxError.getMessage().contains("mismatched character")); + } +}