Skip to content

Commit

Permalink
Merge pull request eclipse-tm4e#46 from pascalleclercq/tests
Browse files Browse the repository at this point in the history
Include all tests during build
  • Loading branch information
angelozerr authored Mar 1, 2017
2 parents 5707d6e + f0de72c commit af5a647
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import junit.framework.Test;
import junit.framework.TestResult;

public class MatcherTest implements Test, Describable {
public class MatcherTestImpl implements Test, Describable {

private static final IMatchesName<List<String>> nameMatcher = new IMatchesName<List<String>>() {

Expand Down Expand Up @@ -56,7 +56,7 @@ private int match(String identifier, List<String> stackElements, int lastIndex)
private List<String> input;
private boolean result;

public MatcherTest() {
public MatcherTestImpl() {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import junit.framework.Test;
import junit.framework.TestResult;

public class RawTest implements Test, Describable {
public class RawTestImpl implements Test, Describable {

private String desc;
private List<String> grammars;
Expand Down Expand Up @@ -78,7 +78,7 @@ public int countTestCases() {
return 1;
}

private static void executeTest(RawTest test, File testLocation) throws Exception {
private static void executeTest(RawTestImpl test, File testLocation) throws Exception {
IGrammarLocator locator = new IGrammarLocator() {

@Override
Expand Down Expand Up @@ -117,7 +117,7 @@ public Collection<String> getInjections(String scopeName) {
}
}

private static IGrammar getGrammar(RawTest test, Registry registry, File testLocation) throws Exception {
private static IGrammar getGrammar(RawTestImpl test, Registry registry, File testLocation) throws Exception {
IGrammar grammar = null;
for (String grammarPath : test.getGrammars()) {
IGrammar tmpGrammar = registry.loadGrammarFromPathSync(new File(testLocation, grammarPath));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import junit.framework.TestSuite;

@RunWith(AllTests.class)
public class VSCodeTextMateTests {
public class VSCodeTextMateTest {

private static final File REPO_ROOT = new File("src/test/resources");

Expand Down Expand Up @@ -66,10 +66,10 @@ private static TestSuite createVSCodeTestSuite(String name, TestSuite parentTest
}

private static void addVSCodeTestSuite(File testLocation, TestSuite suite) throws Exception {
Type listType = new TypeToken<ArrayList<RawTest>>() {
Type listType = new TypeToken<ArrayList<RawTestImpl>>() {
}.getType();
List<RawTest> tests = new GsonBuilder().create().fromJson(new FileReader(testLocation), listType);
for (RawTest test : tests) {
List<RawTestImpl> tests = new GsonBuilder().create().fromJson(new FileReader(testLocation), listType);
for (RawTestImpl test : tests) {
if (!IGNORE_TESTS.contains(test.getDesc())) {
test.setTestLocation(testLocation);
suite.addTest(test);
Expand All @@ -78,12 +78,12 @@ private static void addVSCodeTestSuite(File testLocation, TestSuite suite) throw
}

private static void createMatcherTestSuite(TestSuite suite) throws Exception {
Type listType = new TypeToken<ArrayList<MatcherTest>>() {
Type listType = new TypeToken<ArrayList<MatcherTestImpl>>() {
}.getType();
List<MatcherTest> tests = new GsonBuilder().create()
List<MatcherTestImpl> tests = new GsonBuilder().create()
.fromJson(new FileReader(new File(REPO_ROOT, "matcher-tests.json")), listType);
int i = 0;
for (MatcherTest test : tests) {
for (MatcherTestImpl test : tests) {
test.setDesc("Test #" + (i++));
suite.addTest(test);
}
Expand Down
12 changes: 3 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,7 @@
<version>2.19.1</version>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
</configuration>
<goals>
<goal>test</goal>
</goals>
Expand Down Expand Up @@ -218,9 +212,9 @@
</repository>
</repositories>
<scm>
<url>https://github.com/eclipse/tm4e</url>
<connection>scm:git:https://github.com/eclipse/tm4e.git</connection>
<developerConnection>scm:git:https://github.com/eclipse/tm4e.git</developerConnection>
<url>https://github.com/angelozerr/textmate.java</url>
<connection>scm:git:https://github.com/angelozerr/textmate.java.git</connection>
<developerConnection>scm:git:https://github.com/angelozerr/textmate.java.git</developerConnection>
</scm>
<profiles>
<profile>
Expand Down

0 comments on commit af5a647

Please sign in to comment.