blob: 8e5a22cbfb76075eafdeed3fec651fbc24afc7da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*******************************************************************************
* Copyright (c) 2007, 2011 David Green and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* David Green - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.internal.wikitext.ui.editor.syntax;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import junit.framework.TestCase;
/**
* @author David Green
*/
public abstract class AbstractDocumentTest extends TestCase {
protected IDocument createDocument(String resource) throws IOException {
Document document = new Document();
Reader reader = new BufferedReader(new InputStreamReader(
FastMarkupPartitionerTest.class.getResourceAsStream(resource)));
try {
int i;
StringBuilder buf = new StringBuilder(4096);
while ((i = reader.read()) != -1) {
buf.append((char) i);
}
document.set(buf.toString());
} finally {
reader.close();
}
return document;
}
}
|