Skip to main content
summaryrefslogtreecommitdiffstats
blob: e681a7778a83e4f1ee9b56f39f9b1e6527375e71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*******************************************************************************
 * Copyright (c) 2000, 2009 IBM Corporation 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
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.parser;

public class EnumSelectionTest extends AbstractSelectionTest {
public EnumSelectionTest(String testName) {
	super(testName);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85379
public void test0001() {

	String str =
		"public class X {		\n" +
		"  void foo() {								\n" +
		"    switch(e) {  							\n" +
		"      case A:								\n" +
		"        break;								\n" +
		"    }        								\n" +
		"  }        								\n" +
		"}											\n";

	String selectionStartBehind = "case ";
	String selectionEndBehind = "A";

	String expectedCompletionNodeToString = "<SelectOnName:A>";
	String completionIdentifier = "A";
	String expectedUnitDisplayString =
		"public class X {\n" +
		"  public X() {\n" +
		"  }\n" +
		"  void foo() {\n" +
		"    {\n" +
		"      switch (e) {\n" +
		"      case <SelectOnName:A> : ;\n" +
		"      }\n" +
		"    }\n" +
		"  }\n" +
		"}\n";
	String expectedReplacedSource = "A";
	String testName = "<select test>";

	int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length();
	int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1;

	this.checkMethodParse(
		str.toCharArray(),
		selectionStart,
		selectionEnd,
		expectedCompletionNodeToString,
		expectedUnitDisplayString,
		completionIdentifier,
		expectedReplacedSource,
		testName);
}
}

Back to the top