Search in sources :

Example 1 with TraceFileNameProvider

use of org.eclipse.xtext.generator.trace.TraceFileNameProvider in project xtext-core by eclipse.

the class JavaIoFileSystemAccessTest method testTraceIsCreated.

@Test
public void testTraceIsCreated() throws Exception {
    File file = null;
    try {
        JavaIoFileSystemAccess fileSystemAccess = new JavaIoFileSystemAccess(IResourceServiceProvider.Registry.INSTANCE, new IEncodingProvider.Runtime(), new TraceFileNameProvider(), new TraceRegionSerializer());
        File tmpDir = configureFileSystemAccess(fileSystemAccess);
        SourceRelativeURI uri = new SourceRelativeURI(URI.createURI("foo/bar"));
        CharSequenceTraceWrapper wrapper = new CharSequenceTraceWrapper();
        fileSystemAccess.generateFile("tmp/X", wrapper.wrapWithTraceData("XX", uri, 0, 10, 0, 1));
        file = new File(tmpDir, "tmp/X");
        assertTrue(file.exists());
        assertTrue(file.isFile());
        assertEquals("XX", fileSystemAccess.readTextFile("tmp/X"));
        file = new File(tmpDir, "tmp/.X._trace");
        assertTrue(file.exists());
        assertTrue(file.isFile());
    } finally {
        if (file != null)
            file.delete();
    }
}
Also used : TraceFileNameProvider(org.eclipse.xtext.generator.trace.TraceFileNameProvider) CharSequenceTraceWrapper(org.eclipse.xtext.generator.trace.CharSequenceTraceWrapper) TraceRegionSerializer(org.eclipse.xtext.generator.trace.TraceRegionSerializer) IEncodingProvider(org.eclipse.xtext.parser.IEncodingProvider) File(java.io.File) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI) Test(org.junit.Test)

Aggregations

File (java.io.File)1 CharSequenceTraceWrapper (org.eclipse.xtext.generator.trace.CharSequenceTraceWrapper)1 SourceRelativeURI (org.eclipse.xtext.generator.trace.SourceRelativeURI)1 TraceFileNameProvider (org.eclipse.xtext.generator.trace.TraceFileNameProvider)1 TraceRegionSerializer (org.eclipse.xtext.generator.trace.TraceRegionSerializer)1 IEncodingProvider (org.eclipse.xtext.parser.IEncodingProvider)1 Test (org.junit.Test)1