1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Remove temporary files after test.

This commit is contained in:
Sergey Prigogin 2015-05-19 16:47:47 -07:00
parent f335591877
commit 0052d43d96

View file

@ -13,8 +13,6 @@ package org.eclipse.cdt.internal.pdom.tests;
import java.io.File; import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import junit.framework.Test;
import org.eclipse.cdt.core.dom.ast.tag.ITag; import org.eclipse.cdt.core.dom.ast.tag.ITag;
import org.eclipse.cdt.core.index.IIndexFileLocation; import org.eclipse.cdt.core.index.IIndexFileLocation;
import org.eclipse.cdt.core.index.IIndexLocationConverter; import org.eclipse.cdt.core.index.IIndexLocationConverter;
@ -26,8 +24,11 @@ import org.eclipse.cdt.internal.core.pdom.WritablePDOM;
import org.eclipse.cdt.internal.core.pdom.tag.PDOMTag; import org.eclipse.cdt.internal.core.pdom.tag.PDOMTag;
import org.eclipse.cdt.internal.core.pdom.tag.PDOMTagIndex; import org.eclipse.cdt.internal.core.pdom.tag.PDOMTagIndex;
import junit.framework.Test;
// copy/pasted from BTreeTests // copy/pasted from BTreeTests
public class PDOMTagIndexTests extends BaseTestCase { public class PDOMTagIndexTests extends BaseTestCase {
private File pdomFile;
private PDOM pdom; private PDOM pdom;
public static Test suite() { public static Test suite() {
@ -51,12 +52,9 @@ public class PDOMTagIndexTests extends BaseTestCase {
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
// Create a dummy instance of the PDOM for the various tests to operate pdomFile = File.createTempFile(getClass().getSimpleName() + '.'
// upon. Also acquire the PDOM's write lock to simulate the condition
// under which the tag index is normally accessed.
File tmpFile = File.createTempFile(getClass().getSimpleName() + '.'
+ Double.toString(Math.random()).substring(2), null); + Double.toString(Math.random()).substring(2), null);
pdom = new WritablePDOM(tmpFile, new MockIndexLocationConverter(), pdom = new WritablePDOM(pdomFile, new MockIndexLocationConverter(),
LanguageManager.getInstance().getPDOMLinkageFactoryMappings()); LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
pdom.acquireWriteLock(null); pdom.acquireWriteLock(null);
} }
@ -64,6 +62,7 @@ public class PDOMTagIndexTests extends BaseTestCase {
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
pdom.close(); pdom.close();
pdomFile.delete();
super.tearDown(); super.tearDown();
} }