1 /*******************************************************************************
2 * Copyright (c) 2019 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.jdt.core.tests.compiler.regression;
15
16 import java.util.Map;
17
18 import junit.framework.Test;
19
20 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
21
22 public class Unicode11Test extends AbstractRegressionTest {
Unicode11Test(String name)23 public Unicode11Test(String name) {
24 super(name);
25 }
suite()26 public static Test suite() {
27 return buildMinimalComplianceTestSuite(testClass(), F_12);
28 }
test1()29 public void test1() {
30 Map<String, String> options = getCompilerOptions();
31 options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_12);
32 this.runConformTest(
33 new String[] {
34 "X.java",
35 "public class X {\n" +
36 " public int a\u0560; // new unicode character in unicode 11.0 \n" +
37 "}",
38 },
39 "",
40 options);
41 }
test2()42 public void test2() {
43 Map<String, String> options = getCompilerOptions();
44 options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_11);
45 this.runNegativeTest(
46 new String[] {
47 "X.java",
48 "public class X {\n" +
49 " public int a\\u0560; // new unicode character in unicode 11.0 \n" +
50 "}",
51 },
52 "----------\n" +
53 "1. ERROR in X.java (at line 2)\n" +
54 " public int a\\u0560; // new unicode character in unicode 11.0 \n" +
55 " ^^^^^^\n" +
56 "Syntax error on token \"Invalid Character\", delete this token\n" +
57 "----------\n",
58 null,
59 true,
60 options);
61 }
testClass()62 public static Class<Unicode11Test> testClass() {
63 return Unicode11Test.class;
64 }
65 }
66