Lines 36-44
Link Here
|
36 |
// Use this static initializer to specify subset for tests |
36 |
// Use this static initializer to specify subset for tests |
37 |
// All specified tests which do not belong to the class are skipped... |
37 |
// All specified tests which do not belong to the class are skipped... |
38 |
static { |
38 |
static { |
39 |
// TESTS_NAMES = new String[] { "testMethodOccurences" }; |
39 |
// TESTS_NAMES = new String[] { "testJavaSearchScopeBug101426" }; |
40 |
// TESTS_NUMBERS = new int[] { 101426 }; |
40 |
// TESTS_NUMBERS = new int[] { 101426 }; |
41 |
// TESTS_RANGE = new int[] { 16, -1 }; |
41 |
// TESTS_RANGE = new int[] { 16, -1 }; |
|
|
42 |
// TESTS_PREFIX = "testScopeEncloses"; |
42 |
} |
43 |
} |
43 |
protected void tearDown() throws Exception { |
44 |
protected void tearDown() throws Exception { |
44 |
// Cleanup caches |
45 |
// Cleanup caches |
Lines 872-877
Link Here
|
872 |
deleteProject("P2"); |
873 |
deleteProject("P2"); |
873 |
} |
874 |
} |
874 |
} |
875 |
} |
|
|
876 |
/* |
877 |
* Ensures that a Java project is enclosed in a scope on the project (proj=src) |
878 |
* (resourcePath case) |
879 |
*/ |
880 |
public void testScopeEncloses01() throws CoreException { |
881 |
try { |
882 |
IJavaProject project = createJavaProject("P"); |
883 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
884 |
assertTrue("scope on P should enclose \"/P\"", scope.encloses("/P")); |
885 |
} finally { |
886 |
deleteProject("P"); |
887 |
} |
888 |
} |
889 |
/* |
890 |
* Ensures that a Java project is enclosed in a scope on the project (proj=src) |
891 |
* (Java element case) |
892 |
*/ |
893 |
public void testScopeEncloses02() throws CoreException { |
894 |
try { |
895 |
IJavaProject project = createJavaProject("P"); |
896 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
897 |
assertTrue("scope on P should enclose P", scope.encloses(project)); |
898 |
} finally { |
899 |
deleteProject("P"); |
900 |
} |
901 |
} |
902 |
/* |
903 |
* Ensures that a root is enclosed in a scope on the project (proj=src) |
904 |
* (resource path with traling slash case) |
905 |
*/ |
906 |
public void testScopeEncloses03() throws CoreException { |
907 |
try { |
908 |
IJavaProject project = createJavaProject("P"); |
909 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
910 |
assertTrue("scope on P should enclose \"/P/\"", scope.encloses("/P/")); |
911 |
} finally { |
912 |
deleteProject("P"); |
913 |
} |
914 |
} |
915 |
/* |
916 |
* Ensures that a root is enclosed in a scope on the project (proj=src) |
917 |
* (Java element case) |
918 |
*/ |
919 |
public void testScopeEncloses04() throws CoreException { |
920 |
try { |
921 |
IJavaProject project = createJavaProject("P"); |
922 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
923 |
IPackageFragmentRoot root = project.getPackageFragmentRoot(project.getProject()); |
924 |
assertTrue("scope on P should enclose root P", scope.encloses(root)); |
925 |
} finally { |
926 |
deleteProject("P"); |
927 |
} |
928 |
} |
929 |
/* |
930 |
* Ensures that a package is enclosed in a scope on the project (proj=src) |
931 |
* (resource path case) |
932 |
*/ |
933 |
public void testScopeEncloses05() throws CoreException { |
934 |
try { |
935 |
IJavaProject project = createJavaProject("P"); |
936 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
937 |
assertTrue("scope on P should enclose \"/P/x/y\"", scope.encloses("/P/x/y")); |
938 |
} finally { |
939 |
deleteProject("P"); |
940 |
} |
941 |
} |
942 |
/* |
943 |
* Ensures that a package is enclosed in a scope on the project (proj=src) |
944 |
* (resource path with trailing slash case) |
945 |
*/ |
946 |
public void testScopeEncloses06() throws CoreException { |
947 |
try { |
948 |
IJavaProject project = createJavaProject("P"); |
949 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
950 |
assertTrue("scope on P should enclose \"/P/x/y/\"", scope.encloses("/P/x/y/")); |
951 |
} finally { |
952 |
deleteProject("P"); |
953 |
} |
954 |
} |
955 |
/* |
956 |
* Ensures that a package is enclosed in a scope on the project (proj=src) |
957 |
* (Java element case) |
958 |
*/ |
959 |
public void testScopeEncloses07() throws CoreException { |
960 |
try { |
961 |
IJavaProject project = createJavaProject("P"); |
962 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
963 |
IPackageFragment pkg = getPackage("/P/x/y"); |
964 |
assertTrue("scope on P should enclose package x.y", scope.encloses(pkg)); |
965 |
} finally { |
966 |
deleteProject("P"); |
967 |
} |
968 |
} |
969 |
/* |
970 |
* Ensures that a default package is enclosed in a scope on the project (proj=src) |
971 |
* (Java element case) |
972 |
*/ |
973 |
public void testScopeEncloses08() throws CoreException { |
974 |
try { |
975 |
IJavaProject project = createJavaProject("P"); |
976 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
977 |
IPackageFragment pkg = getPackage("/P"); |
978 |
assertTrue("scope on P should enclose default package", scope.encloses(pkg)); |
979 |
} finally { |
980 |
deleteProject("P"); |
981 |
} |
982 |
} |
983 |
/* |
984 |
* Ensures that a compilation unit is enclosed in a scope on the project (proj=src) |
985 |
* (resource path case) |
986 |
*/ |
987 |
public void testScopeEncloses09() throws CoreException { |
988 |
try { |
989 |
IJavaProject project = createJavaProject("P"); |
990 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
991 |
assertTrue("scope on P should enclose \"/P/x/y/A.java\"", scope.encloses("/P/x/y/A.java")); |
992 |
} finally { |
993 |
deleteProject("P"); |
994 |
} |
995 |
} |
996 |
/* |
997 |
* Ensures that a compilation unit is enclosed in a scope on the project (proj=src) |
998 |
* (Java element case) |
999 |
*/ |
1000 |
public void testScopeEncloses10() throws CoreException { |
1001 |
try { |
1002 |
IJavaProject project = createJavaProject("P"); |
1003 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1004 |
ICompilationUnit cu = getCompilationUnit("/P/x/y/A.java"); |
1005 |
assertTrue("scope on P should enclose compilation unit A.java", scope.encloses(cu)); |
1006 |
} finally { |
1007 |
deleteProject("P"); |
1008 |
} |
1009 |
} |
1010 |
/* |
1011 |
* Ensures that a compilation unit in the default package is enclosed in a scope on the project (proj=src) |
1012 |
* (resource path case) |
1013 |
*/ |
1014 |
public void testScopeEncloses11() throws CoreException { |
1015 |
try { |
1016 |
IJavaProject project = createJavaProject("P"); |
1017 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1018 |
assertTrue("scope on P should enclose \"/P/A.java\"", scope.encloses("/P/A.java")); |
1019 |
} finally { |
1020 |
deleteProject("P"); |
1021 |
} |
1022 |
} |
1023 |
/* |
1024 |
* Ensures that a compilation unit in the default package is enclosed in a scope on the project (proj=src) |
1025 |
* (Java element case) |
1026 |
*/ |
1027 |
public void testScopeEncloses12() throws CoreException { |
1028 |
try { |
1029 |
IJavaProject project = createJavaProject("P"); |
1030 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1031 |
ICompilationUnit cu = getCompilationUnit("/P/A.java"); |
1032 |
assertTrue("scope on P should enclose compilation unit A.java", scope.encloses(cu)); |
1033 |
} finally { |
1034 |
deleteProject("P"); |
1035 |
} |
1036 |
} |
1037 |
/* |
1038 |
* Ensures that a source type is enclosed in a scope on the project (proj=src) |
1039 |
* (Java element case) |
1040 |
*/ |
1041 |
public void testScopeEncloses13() throws CoreException { |
1042 |
try { |
1043 |
IJavaProject project = createJavaProject("P"); |
1044 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1045 |
ICompilationUnit cu = getCompilationUnit("/P/x/y/A.java"); |
1046 |
IType type = cu.getType("A"); |
1047 |
assertTrue("scope on P should enclose type A", scope.encloses(type)); |
1048 |
} finally { |
1049 |
deleteProject("P"); |
1050 |
} |
1051 |
} |
1052 |
/* |
1053 |
* Ensures that a Java project is not enclosed in a scope on the project (proj != src) |
1054 |
* (resourcePath case) |
1055 |
*/ |
1056 |
public void testScopeEncloses14() throws CoreException { |
1057 |
try { |
1058 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1059 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1060 |
assertTrue("scope on P should not enclose \"/P\"", !scope.encloses("/P")); |
1061 |
} finally { |
1062 |
deleteProject("P"); |
1063 |
} |
1064 |
} |
1065 |
/* |
1066 |
* Ensures that a Java project is not enclosed in a scope on the project (proj != src) |
1067 |
* (Java element case) |
1068 |
*/ |
1069 |
public void testScopeEncloses15() throws CoreException { |
1070 |
try { |
1071 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1072 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1073 |
assertTrue("scope on P should enclose P", !scope.encloses(project)); |
1074 |
} finally { |
1075 |
deleteProject("P"); |
1076 |
} |
1077 |
} |
1078 |
/* |
1079 |
* Ensures that a root is enclosed in a scope on the project (proj != src) |
1080 |
* (resource path case) |
1081 |
*/ |
1082 |
public void testScopeEncloses16() throws CoreException { |
1083 |
try { |
1084 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1085 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1086 |
assertTrue("scope on P should enclose \"/P/src\"", scope.encloses("/P/src")); |
1087 |
} finally { |
1088 |
deleteProject("P"); |
1089 |
} |
1090 |
} |
1091 |
/* |
1092 |
* Ensures that a root is enclosed in a scope on the project (proj != src) |
1093 |
* (resource path with traling slash case) |
1094 |
*/ |
1095 |
public void testScopeEncloses17() throws CoreException { |
1096 |
try { |
1097 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1098 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1099 |
assertTrue("scope on P should enclose \"/P/src/\"", scope.encloses("/P/src/")); |
1100 |
} finally { |
1101 |
deleteProject("P"); |
1102 |
} |
1103 |
} |
1104 |
/* |
1105 |
* Ensures that a root is enclosed in a scope on the project (proj != src) |
1106 |
* (Java element case) |
1107 |
*/ |
1108 |
public void testScopeEncloses18() throws CoreException { |
1109 |
try { |
1110 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1111 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1112 |
IPackageFragmentRoot root = project.getPackageFragmentRoot(project.getProject().getFolder("src")); |
1113 |
assertTrue("scope on P should enclose root P/src", scope.encloses(root)); |
1114 |
} finally { |
1115 |
deleteProject("P"); |
1116 |
} |
1117 |
} |
1118 |
/* |
1119 |
* Ensures that a package is enclosed in a scope on the project (proj != src) |
1120 |
* (resource path case) |
1121 |
*/ |
1122 |
public void testScopeEncloses19() throws CoreException { |
1123 |
try { |
1124 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1125 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1126 |
assertTrue("scope on P should enclose \"/P/src/x/y\"", scope.encloses("/P/src/x/y")); |
1127 |
} finally { |
1128 |
deleteProject("P"); |
1129 |
} |
1130 |
} |
1131 |
/* |
1132 |
* Ensures that a package is enclosed in a scope on the project (proj != src) |
1133 |
* (resource path with trailing slash case) |
1134 |
*/ |
1135 |
public void testScopeEncloses20() throws CoreException { |
1136 |
try { |
1137 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1138 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1139 |
assertTrue("scope on P should enclose \"/P/src/x/y/\"", scope.encloses("/P/src/x/y/")); |
1140 |
} finally { |
1141 |
deleteProject("P"); |
1142 |
} |
1143 |
} |
1144 |
/* |
1145 |
* Ensures that a package is enclosed in a scope on the project (proj != src) |
1146 |
* (Java element case) |
1147 |
*/ |
1148 |
public void testScopeEncloses21() throws CoreException { |
1149 |
try { |
1150 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1151 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1152 |
IPackageFragment pkg = getPackage("/P/src/x/y"); |
1153 |
assertTrue("scope on P should enclose package x.y", scope.encloses(pkg)); |
1154 |
} finally { |
1155 |
deleteProject("P"); |
1156 |
} |
1157 |
} |
1158 |
/* |
1159 |
* Ensures that a default package is enclosed in a scope on the project (proj != src) |
1160 |
* (Java element case) |
1161 |
*/ |
1162 |
public void testScopeEncloses22() throws CoreException { |
1163 |
try { |
1164 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1165 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1166 |
IPackageFragment pkg = getPackage("/P/src"); |
1167 |
assertTrue("scope on P should enclose default package", scope.encloses(pkg)); |
1168 |
} finally { |
1169 |
deleteProject("P"); |
1170 |
} |
1171 |
} |
1172 |
/* |
1173 |
* Ensures that a compilation unit is enclosed in a scope on the project (proj != src) |
1174 |
* (resource path case) |
1175 |
*/ |
1176 |
public void testScopeEncloses23() throws CoreException { |
1177 |
try { |
1178 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1179 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1180 |
assertTrue("scope on P should enclose \"/P/src/x/y/A.java\"", scope.encloses("/P/src/x/y/A.java")); |
1181 |
} finally { |
1182 |
deleteProject("P"); |
1183 |
} |
1184 |
} |
1185 |
/* |
1186 |
* Ensures that a compilation unit is enclosed in a scope on the project (proj != src) |
1187 |
* (Java element case) |
1188 |
*/ |
1189 |
public void testScopeEncloses24() throws CoreException { |
1190 |
try { |
1191 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1192 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1193 |
ICompilationUnit cu = getCompilationUnit("/P/src/x/y/A.java"); |
1194 |
assertTrue("scope on P should enclose compilation unit A.java", scope.encloses(cu)); |
1195 |
} finally { |
1196 |
deleteProject("P"); |
1197 |
} |
1198 |
} |
1199 |
/* |
1200 |
* Ensures that a compilation unit in the default package is enclosed in a scope on the project (proj != src) |
1201 |
* (resource path case) |
1202 |
*/ |
1203 |
public void testScopeEncloses25() throws CoreException { |
1204 |
try { |
1205 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1206 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1207 |
assertTrue("scope on P should enclose \"/P/src/A.java\"", scope.encloses("/P/src/A.java")); |
1208 |
} finally { |
1209 |
deleteProject("P"); |
1210 |
} |
1211 |
} |
1212 |
/* |
1213 |
* Ensures that a compilation unit in the default package is enclosed in a scope on the project (proj != src) |
1214 |
* (Java element case) |
1215 |
*/ |
1216 |
public void testScopeEncloses26() throws CoreException { |
1217 |
try { |
1218 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1219 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1220 |
ICompilationUnit cu = getCompilationUnit("/P/src/A.java"); |
1221 |
assertTrue("scope on P should enclose compilation unit A.java", scope.encloses(cu)); |
1222 |
} finally { |
1223 |
deleteProject("P"); |
1224 |
} |
1225 |
} |
1226 |
/* |
1227 |
* Ensures that a source type is enclosed in a scope on the project (proj != src) |
1228 |
* (Java element case) |
1229 |
*/ |
1230 |
public void testScopeEncloses27() throws CoreException { |
1231 |
try { |
1232 |
IJavaProject project = createJavaProject("P", new String[] {"src"}, "bin"); |
1233 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1234 |
ICompilationUnit cu = getCompilationUnit("/P/src/x/y/A.java"); |
1235 |
IType type = cu.getType("A"); |
1236 |
assertTrue("scope on P should enclose type A", scope.encloses(type)); |
1237 |
} finally { |
1238 |
deleteProject("P"); |
1239 |
} |
1240 |
} |
1241 |
/* |
1242 |
* Ensures that a Java project is not enclosed in a scope on the project (proj != src/) |
1243 |
* (resourcePath case) |
1244 |
*/ |
1245 |
public void testScopeEncloses28() throws CoreException { |
1246 |
try { |
1247 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1248 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1249 |
assertTrue("scope on P should not enclose \"/P\"", !scope.encloses("/P")); |
1250 |
} finally { |
1251 |
deleteProject("P"); |
1252 |
} |
1253 |
} |
1254 |
/* |
1255 |
* Ensures that a Java project is not enclosed in a scope on the project (proj != src/) |
1256 |
* (Java element case) |
1257 |
*/ |
1258 |
public void testScopeEncloses29() throws CoreException { |
1259 |
try { |
1260 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1261 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1262 |
assertTrue("scope on P should enclose P", !scope.encloses(project)); |
1263 |
} finally { |
1264 |
deleteProject("P"); |
1265 |
} |
1266 |
} |
1267 |
/* |
1268 |
* Ensures that a root is enclosed in a scope on the project (proj != src/) |
1269 |
* (resource path case) |
1270 |
*/ |
1271 |
public void testScopeEncloses30() throws CoreException { |
1272 |
try { |
1273 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1274 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1275 |
assertTrue("scope on P should enclose \"/P/src\"", scope.encloses("/P/src")); |
1276 |
} finally { |
1277 |
deleteProject("P"); |
1278 |
} |
1279 |
} |
1280 |
/* |
1281 |
* Ensures that a root is enclosed in a scope on the project (proj != src/) |
1282 |
* (resource path with traling slash case) |
1283 |
*/ |
1284 |
public void testScopeEncloses31() throws CoreException { |
1285 |
try { |
1286 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1287 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1288 |
assertTrue("scope on P should enclose \"/P/src/\"", scope.encloses("/P/src/")); |
1289 |
} finally { |
1290 |
deleteProject("P"); |
1291 |
} |
1292 |
} |
1293 |
/* |
1294 |
* Ensures that a root is enclosed in a scope on the project (proj != src/) |
1295 |
* (Java element case) |
1296 |
*/ |
1297 |
public void testScopeEncloses32() throws CoreException { |
1298 |
try { |
1299 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1300 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1301 |
IPackageFragmentRoot root = project.getPackageFragmentRoot(project.getProject().getFolder("src")); |
1302 |
assertTrue("scope on P should enclose root P/src", scope.encloses(root)); |
1303 |
} finally { |
1304 |
deleteProject("P"); |
1305 |
} |
1306 |
} |
1307 |
/* |
1308 |
* Ensures that a package is enclosed in a scope on the project (proj != src/) |
1309 |
* (resource path case) |
1310 |
*/ |
1311 |
public void testScopeEncloses33() throws CoreException { |
1312 |
try { |
1313 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1314 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1315 |
assertTrue("scope on P should enclose \"/P/src/x/y\"", scope.encloses("/P/src/x/y")); |
1316 |
} finally { |
1317 |
deleteProject("P"); |
1318 |
} |
1319 |
} |
1320 |
/* |
1321 |
* Ensures that a package is enclosed in a scope on the project (proj != src/) |
1322 |
* (resource path with trailing slash case) |
1323 |
*/ |
1324 |
public void testScopeEncloses34() throws CoreException { |
1325 |
try { |
1326 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1327 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1328 |
assertTrue("scope on P should enclose \"/P/src/x/y/\"", scope.encloses("/P/src/x/y/")); |
1329 |
} finally { |
1330 |
deleteProject("P"); |
1331 |
} |
1332 |
} |
1333 |
/* |
1334 |
* Ensures that a package is enclosed in a scope on the project (proj != src/) |
1335 |
* (Java element case) |
1336 |
*/ |
1337 |
public void testScopeEncloses35() throws CoreException { |
1338 |
try { |
1339 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1340 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1341 |
IPackageFragment pkg = getPackage("/P/src/x/y"); |
1342 |
assertTrue("scope on P should enclose package x.y", scope.encloses(pkg)); |
1343 |
} finally { |
1344 |
deleteProject("P"); |
1345 |
} |
1346 |
} |
1347 |
/* |
1348 |
* Ensures that a default package is enclosed in a scope on the project (proj != src/) |
1349 |
* (Java element case) |
1350 |
*/ |
1351 |
public void testScopeEncloses36() throws CoreException { |
1352 |
try { |
1353 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1354 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1355 |
IPackageFragment pkg = getPackage("/P/src"); |
1356 |
assertTrue("scope on P should enclose default package", scope.encloses(pkg)); |
1357 |
} finally { |
1358 |
deleteProject("P"); |
1359 |
} |
1360 |
} |
1361 |
/* |
1362 |
* Ensures that a compilation unit is enclosed in a scope on the project (proj != src/) |
1363 |
* (resource path case) |
1364 |
*/ |
1365 |
public void testScopeEncloses37() throws CoreException { |
1366 |
try { |
1367 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1368 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1369 |
assertTrue("scope on P should enclose \"/P/src/x/y/A.java\"", scope.encloses("/P/src/x/y/A.java")); |
1370 |
} finally { |
1371 |
deleteProject("P"); |
1372 |
} |
1373 |
} |
1374 |
/* |
1375 |
* Ensures that a compilation unit is enclosed in a scope on the project (proj != src/) |
1376 |
* (Java element case) |
1377 |
*/ |
1378 |
public void testScopeEncloses38() throws CoreException { |
1379 |
try { |
1380 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1381 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1382 |
ICompilationUnit cu = getCompilationUnit("/P/src/x/y/A.java"); |
1383 |
assertTrue("scope on P should enclose compilation unit A.java", scope.encloses(cu)); |
1384 |
} finally { |
1385 |
deleteProject("P"); |
1386 |
} |
1387 |
} |
1388 |
/* |
1389 |
* Ensures that a compilation unit in the default package is enclosed in a scope on the project (proj != src/) |
1390 |
* (resource path case) |
1391 |
*/ |
1392 |
public void testScopeEncloses39() throws CoreException { |
1393 |
try { |
1394 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1395 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1396 |
assertTrue("scope on P should enclose \"/P/src/A.java\"", scope.encloses("/P/src/A.java")); |
1397 |
} finally { |
1398 |
deleteProject("P"); |
1399 |
} |
1400 |
} |
1401 |
/* |
1402 |
* Ensures that a compilation unit in the default package is enclosed in a scope on the project (proj != src/) |
1403 |
* (Java element case) |
1404 |
*/ |
1405 |
public void testScopeEncloses40() throws CoreException { |
1406 |
try { |
1407 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1408 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1409 |
ICompilationUnit cu = getCompilationUnit("/P/src/A.java"); |
1410 |
assertTrue("scope on P should enclose compilation unit A.java", scope.encloses(cu)); |
1411 |
} finally { |
1412 |
deleteProject("P"); |
1413 |
} |
1414 |
} |
1415 |
/* |
1416 |
* Ensures that a source type is enclosed in a scope on the project (proj != src/) |
1417 |
* (Java element case) |
1418 |
*/ |
1419 |
public void testScopeEncloses41() throws CoreException { |
1420 |
try { |
1421 |
IJavaProject project = createJavaProject("P", new String[] {"src/"}, "bin"); |
1422 |
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); |
1423 |
ICompilationUnit cu = getCompilationUnit("/P/src/x/y/A.java"); |
1424 |
IType type = cu.getType("A"); |
1425 |
assertTrue("scope on P should enclose type A", scope.encloses(type)); |
1426 |
} finally { |
1427 |
deleteProject("P"); |
1428 |
} |
1429 |
} |
875 |
/** |
1430 |
/** |
876 |
* Type declaration in external jar file that is shared by 2 projects. |
1431 |
* Type declaration in external jar file that is shared by 2 projects. |
877 |
* (regression test for bug 27485 SearchEngine returns wrong java element when searching in an archive that is included by two distinct java projects.) |
1432 |
* (regression test for bug 27485 SearchEngine returns wrong java element when searching in an archive that is included by two distinct java projects.) |