Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2005, 2008 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 |
7 |
* |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.core.tests.compiler.regression; |
12 |
|
13 |
import java.util.Map; |
14 |
|
15 |
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; |
16 |
|
17 |
import junit.framework.Test; |
18 |
|
19 |
public class AssignmentTest_1_7 extends AbstractRegressionTest { |
20 |
|
21 |
public AssignmentTest_1_7(String name) { |
22 |
super(name); |
23 |
} |
24 |
protected Map getCompilerOptions() { |
25 |
Map options = super.getCompilerOptions(); |
26 |
options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.ERROR); |
27 |
options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.ERROR); |
28 |
options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.ERROR); |
29 |
options.put(CompilerOptions.OPTION_ReportNoEffectAssignment, CompilerOptions.ERROR); |
30 |
return options; |
31 |
} |
32 |
// Static initializer to specify tests subset using TESTS_* static variables |
33 |
// All specified tests which does not belong to the class are skipped... |
34 |
static { |
35 |
// TESTS_NAMES = new String[] { "test000" }; |
36 |
// TESTS_NUMBERS = new int[] { 61 }; |
37 |
// TESTS_RANGE = new int[] { 11, -1 }; |
38 |
} |
39 |
public static Test suite() { |
40 |
return buildMinimalComplianceTestSuite(testClass(), F_1_7); |
41 |
} |
42 |
/* |
43 |
* no effect assignment bug |
44 |
* http://bugs.eclipse.org/bugs/show_bug.cgi?id=27235 |
45 |
*/ |
46 |
public void test001() { |
47 |
this.runConformTest( |
48 |
new String[] { |
49 |
"X.java", |
50 |
"public class X {\n" + |
51 |
" public static void main(String[] args) {\n" + |
52 |
" Object o = new X();\n" + |
53 |
" String s = \"ESS\";\n" + |
54 |
" o += s;\n" + |
55 |
" System.out.println(o);\n" + |
56 |
" }\n" + |
57 |
" public String toString() {\n" + |
58 |
" return \"SUCC\";\n" + |
59 |
" }\n" + |
60 |
"}", |
61 |
}, |
62 |
"SUCCESS"); |
63 |
} |
64 |
public static Class testClass() { |
65 |
return AssignmentTest_1_7.class; |
66 |
} |
67 |
} |