Lines 11-16
Link Here
|
11 |
package org.eclipse.jdt.core.tests.compiler.regression; |
11 |
package org.eclipse.jdt.core.tests.compiler.regression; |
12 |
|
12 |
|
13 |
import org.eclipse.jdt.core.compiler.CharOperation; |
13 |
import org.eclipse.jdt.core.compiler.CharOperation; |
|
|
14 |
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; |
14 |
|
15 |
|
15 |
import junit.framework.Test; |
16 |
import junit.framework.Test; |
16 |
|
17 |
|
Lines 77-80
Link Here
|
77 |
public static Class testClass() { |
78 |
public static Class testClass() { |
78 |
return CharOperationTest.class; |
79 |
return CharOperationTest.class; |
79 |
} |
80 |
} |
|
|
81 |
|
82 |
public void testCamel() { |
83 |
String[][] MATCHES = { |
84 |
{"TZ","TimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
85 |
{"TiZ","TimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
86 |
{"TiZon","TimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
87 |
{"TZon","TimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
88 |
{"TZone","TimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
89 |
{"TimeZone","TimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
90 |
{"TimeZ","TimeZ"}, //$NON-NLS-1$//$NON-NLS-2$ |
91 |
{"TZ","TimeZ"}, //$NON-NLS-1$//$NON-NLS-2$ |
92 |
{"T","TimeZ"}, //$NON-NLS-1$//$NON-NLS-2$ |
93 |
{"T","TimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
94 |
{"TZ","TZ"}, //$NON-NLS-1$//$NON-NLS-2$ |
95 |
{"aT","aTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
96 |
{"aTi","aTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
97 |
{"aTiZ","aTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
98 |
{"aTZ","aTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
99 |
{"aT","artTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
100 |
{"aTi","artTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
101 |
{"aTiZ","artTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
102 |
{"aTZ","artTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
103 |
}; |
104 |
|
105 |
for (int i = 0; i<MATCHES.length ; i++) { |
106 |
String[] match = MATCHES[i]; |
107 |
assertTrue (match[0] + ":" + match[1], CharOperation.camelCaseMatch(match[0].toCharArray(), match[1].toCharArray())); //$NON-NLS-1$ |
108 |
} |
109 |
|
110 |
String[][] MIS_MATCHES = { |
111 |
{"TZ","Timezone"}, //$NON-NLS-1$//$NON-NLS-2$ |
112 |
{"aTZ","TimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
113 |
{"aTZ","TZ"}, //$NON-NLS-1$//$NON-NLS-2$ |
114 |
{"arT","aTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
115 |
{"arTi","aTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
116 |
{"arTiZ","aTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
117 |
{"arTZ","aTimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
118 |
{"aT","atimeZone"}, //$NON-NLS-1$//$NON-NLS-2$ |
119 |
}; |
120 |
|
121 |
for (int i = 0; i<MIS_MATCHES.length ; i++) { |
122 |
String[] match = MIS_MATCHES[i]; |
123 |
assertFalse (match[0] + ":" + match[1], CharOperation.camelCaseMatch(match[0].toCharArray(), match[1].toCharArray())); //$NON-NLS-1$ |
124 |
} |
125 |
|
126 |
} |
127 |
|
80 |
} |
128 |
} |