1
/*******************************************************************************
2
* Copyright (c) 2006, 2009 IBM Corporation and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* IBM Corporation - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.core.lrparser.tests;
13
import junit.framework.TestSuite;
15
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
16
import org.eclipse.cdt.core.dom.lrparser.gnu.GCCLanguage;
17
import org.eclipse.cdt.core.dom.lrparser.gnu.GPPLanguage;
18
import org.eclipse.cdt.core.model.ILanguage;
19
import org.eclipse.cdt.core.parser.ParserLanguage;
20
import org.eclipse.cdt.core.parser.tests.ast2.AST2KnRTests;
21
import org.eclipse.cdt.internal.core.parser.ParserException;
26
@SuppressWarnings("restriction")
27
public class LRKnRTests extends AST2KnRTests {
29
public static TestSuite suite() {
30
return suite(LRKnRTests.class);
34
@SuppressWarnings("unused")
35
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
36
ILanguage language = lang.isCPP() ? getCPPLanguage() : getCLanguage();
37
return ParseHelper.parse(code, language, expectNoProblems);
41
protected ILanguage getCLanguage() {
42
return GCCLanguage.getDefault();
45
protected ILanguage getCPPLanguage() {
46
return GPPLanguage.getDefault();
49
// LPG handles syntax errors differently than the DOM parser
50
// these tests look for syntax errors in specific places and they fail
53
public void testKRCProblem3() throws Exception {
55
super.testKRCProblem3();
57
} catch(Throwable _) { }
61
public void testKRCProblem4() throws Exception {
63
super.testKRCProblem4();
65
} catch(Throwable _) { }
69
public void testKRCProblem5() throws Exception {
71
super.testKRCProblem5();
73
} catch(Throwable _) { }
77
public void testKRCProblem2() throws Exception {
79
super.testKRCProblem2();
81
} catch(Throwable _) { }