View | Details | Raw Unified | Return to bug 101425 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/ClasspathTests.java (-2 / +90 lines)
Lines 75-82 Link Here
75
// All specified tests which do not belong to the class are skipped...
75
// All specified tests which do not belong to the class are skipped...
76
static {
76
static {
77
	// Names of tests to run: can be "testBugXXXX" or "BugXXXX")
77
	// Names of tests to run: can be "testBugXXXX" or "BugXXXX")
78
//	TESTS_PREFIX = "testClasspathDuplicateExtraAttribute";
78
//	TESTS_PREFIX = "testUnknownElements";
79
//	TESTS_NAMES = new String[] {"testExportContainer"};
79
//	TESTS_NAMES = new String[] {"testExtraAttributes4"};
80
//	TESTS_NUMBERS = new int[] { 23, 28, 38 };
80
//	TESTS_NUMBERS = new int[] { 23, 28, 38 };
81
//	TESTS_RANGE = new int[] { 21, 38 };
81
//	TESTS_RANGE = new int[] { 21, 38 };
82
}
82
}
Lines 3322-3327 Link Here
3322
	}
3322
	}
3323
}
3323
}
3324
3324
3325
/*
3326
 * Ensures that unknown classpath attributes in a .classpath file are not lost when read and rewritten.
3327
 * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes)
3328
 */
3329
public void testUnknownAttributes() throws CoreException {
3330
	try {
3331
		IJavaProject project = createJavaProject("P");
3332
		editFile(
3333
			"/P/.classpath",
3334
			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + 
3335
			"<classpath>\n" + 
3336
			"	<classpathentry unknown=\"test\" kind=\"src\" path=\"src1\"/>\n" + 
3337
			"	<classpathentry kind=\"src\" path=\"src2\"/>\n" + 
3338
			"	<classpathentry kind=\"output\" path=\"bin\"/>\n" + 
3339
			"</classpath>\n"
3340
		);
3341
		IClasspathEntry[] classpath = project.getRawClasspath();
3342
		
3343
		// swap 2 entries
3344
		IClasspathEntry src1 = classpath[0];
3345
		classpath[0] = classpath[1];
3346
		classpath[1] = src1;
3347
		project.setRawClasspath(classpath, null);
3348
		
3349
		// check that .classpath has correct content
3350
		String contents = new String (org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.classpath")));
3351
		assertSourceEquals(
3352
			"Unexpected content", 
3353
			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + 
3354
			"<classpath>\n" + 
3355
			"	<classpathentry kind=\"src\" path=\"src2\"/>\n" + 
3356
			"	<classpathentry unknown=\"test\" kind=\"src\" path=\"src1\"/>\n" + 
3357
			"	<classpathentry kind=\"output\" path=\"bin\"/>\n" + 
3358
			"</classpath>\n",			
3359
			contents);		
3360
	} finally {
3361
		deleteProject("P");
3362
	}
3363
}
3364
3365
/*
3366
 * Ensures that unknown classpath elements in a .classpath file are not lost when read and rewritten.
3367
 * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes)
3368
 */
3369
public void testUnknownElements() throws CoreException {
3370
	try {
3371
		IJavaProject project = createJavaProject("P");
3372
		editFile(
3373
			"/P/.classpath",
3374
			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + 
3375
			"<classpath>\n" + 
3376
			"	<classpathentry kind=\"src\" path=\"src1\">\n" + 
3377
			"		<unknown>\n" +
3378
			"			<test kind=\"\"/>\n" +
3379
			"		</unknown>\n" +
3380
			"	</classpathentry>\n" +
3381
			"	<classpathentry kind=\"src\" path=\"src2\"/>\n" + 
3382
			"	<classpathentry kind=\"output\" path=\"bin\"/>\n" + 
3383
			"</classpath>\n"
3384
		);
3385
		IClasspathEntry[] classpath = project.getRawClasspath();
3386
		
3387
		// swap 2 entries
3388
		IClasspathEntry src1 = classpath[0];
3389
		classpath[0] = classpath[1];
3390
		classpath[1] = src1;
3391
		project.setRawClasspath(classpath, null);
3392
		
3393
		// check that .classpath has correct content
3394
		String contents = new String (org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.classpath")));
3395
		assertSourceEquals(
3396
			"Unexpected content", 
3397
			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + 
3398
			"<classpath>\n" + 
3399
			"	<classpathentry kind=\"src\" path=\"src2\"/>\n" + 
3400
			"	<classpathentry kind=\"src\" path=\"src1\">\n" + 
3401
			"		<unknown>\n" +
3402
			"			<test kind=\"\" />\n" +
3403
			"		</unknown>\n" +
3404
			"	</classpathentry>\n" +
3405
			"	<classpathentry kind=\"output\" path=\"bin\"/>\n" + 
3406
			"</classpath>\n",			
3407
			contents);		
3408
	} finally {
3409
		deleteProject("P");
3410
	}
3411
}
3412
3325
/**
3413
/**
3326
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992
3414
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992
3327
 * Check that Assert.AssertionFailedException exception is well catched
3415
 * Check that Assert.AssertionFailedException exception is well catched
(-)src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java (-1 / +1 lines)
Lines 63-69 Link Here
63
// All specified tests which do not belong to the class are skipped...
63
// All specified tests which do not belong to the class are skipped...
64
static {
64
static {
65
	// Names of tests to run: can be "testBugXXXX" or "BugXXXX")
65
	// Names of tests to run: can be "testBugXXXX" or "BugXXXX")
66
	// TESTS_NAMES = new String[] { "testTwoProjectsWithDifferentCompliances" };
66
//	 TESTS_NAMES = new String[] { "testAccessRestriction5" };
67
	// Numbers of tests to run: "test<number>" will be run for each number of this array
67
	// Numbers of tests to run: "test<number>" will be run for each number of this array
68
	//TESTS_NUMBERS = new int[] { 13 };
68
	//TESTS_NUMBERS = new int[] { 13 };
69
	// Range numbers of tests to run: all tests between "test<first>" and "test<last>" will be run for { first, last }
69
	// Range numbers of tests to run: all tests between "test<first>" and "test<last>" will be run for { first, last }

Return to bug 101425