| /******************************************************************************* |
| * Copyright (c) 2007, 2011 IBM Corporation and others. |
| * |
| * This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * IBM Rational Software - Initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.cdt.ui.tests.text.contentassist2; |
| |
| import junit.framework.Test; |
| import junit.framework.TestSuite; |
| |
| /** |
| * @author hamer |
| * |
| * Testing Macro_Reference, with no prefix |
| * Bug#50487 :Wrong completion kind and prefix after "#ifdef" |
| * |
| */ |
| public class MacroRef_NoPrefix_CompletionTest extends CompletionProposalsBaseTest { |
| |
| private final String fileName = "CompletionTestStart26.cpp"; |
| private final String fileFullPath = "resources/contentassist/" + fileName; |
| private final String headerFileName = "CompletionTestStart.h"; |
| private final String headerFileFullPath = "resources/contentassist/" + headerFileName; |
| private final String expectedPrefix = ""; |
| private final String[] expectedResults = { "AMacro(x)", "DEBUG", "XMacro(x, y)", "__CDT_PARSER__", "__COUNTER__", |
| "__DATE__", "__FILE__", "__LINE__", "__STDC__", "__TIME__", "__builtin_va_arg(ap, type)", |
| "__builtin_offsetof(T, m)", "__builtin_types_compatible_p(x, y)", "__complex__", "__cplusplus", |
| "__extension__", "__has_include", "__has_include_next", "__imag__", "__null", "__offsetof__(x)", "__real__", |
| "__stdcall", "__thread", }; |
| |
| public MacroRef_NoPrefix_CompletionTest(String name) { |
| super(name); |
| } |
| |
| public static Test suite() { |
| TestSuite suite = new TestSuite(MacroRef_NoPrefix_CompletionTest.class.getName()); |
| suite.addTest(new MacroRef_NoPrefix_CompletionTest("testCompletionProposals")); |
| return suite; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() |
| */ |
| @Override |
| protected int getCompletionPosition() { |
| return getBuffer().indexOf("#ifdef ") + 7; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() |
| */ |
| @Override |
| protected String getExpectedPrefix() { |
| return expectedPrefix; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() |
| */ |
| @Override |
| protected String[] getExpectedResultsValues() { |
| return expectedResults; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() |
| */ |
| @Override |
| protected String getFileName() { |
| return fileName; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() |
| */ |
| @Override |
| protected String getFileFullPath() { |
| return fileFullPath; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() |
| */ |
| @Override |
| protected String getHeaderFileFullPath() { |
| return headerFileFullPath; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() |
| */ |
| @Override |
| protected String getHeaderFileName() { |
| return headerFileName; |
| } |
| |
| } |