Skip to content

Commit

Permalink
[testing] processing subtests output
Browse files Browse the repository at this point in the history
  • Loading branch information
zolotov committed Oct 15, 2016
1 parent f2893c8 commit 25b8b03
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import java.util.regex.Pattern;

public class GotestEventsConverter extends GoTestEventsConverterBaseImpl {
private static final Pattern RUN = Pattern.compile("^=== RUN\\s+(" + GoConstants.IDENTIFIER_REGEX + ")");
private static final Pattern PASSED = Pattern.compile("--- PASS:\\s+(" + GoConstants.IDENTIFIER_REGEX + ")");
private static final Pattern SKIP = Pattern.compile("--- SKIP:\\s+(" + GoConstants.IDENTIFIER_REGEX + ")");
private static final Pattern FAILED = Pattern.compile("--- FAIL:\\s+(" + GoConstants.IDENTIFIER_REGEX + ")");
private static final Pattern RUN = Pattern.compile("^=== RUN\\s+(" + GoConstants.TEST_NAME_REGEX + ")");
private static final Pattern PASSED = Pattern.compile("--- PASS:\\s+(" + GoConstants.TEST_NAME_REGEX + ")");
private static final Pattern SKIP = Pattern.compile("--- SKIP:\\s+(" + GoConstants.TEST_NAME_REGEX + ")");
private static final Pattern FAILED = Pattern.compile("--- FAIL:\\s+(" + GoConstants.TEST_NAME_REGEX + ")");
private static final Pattern FINISHED = Pattern.compile("^(PASS)|(FAIL)$");

public GotestEventsConverter(@NotNull TestConsoleProperties consoleProperties) {
Expand Down
96 changes: 96 additions & 0 deletions testData/testing/gotest/subTests-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
TestStarted
- locationHint=gotest://TestFoo
- name=TestFoo
TestStarted
- locationHint=gotest://TestFoo/k[h]kjh_khk_jh
- name=TestFoo/k[h]kjh_khk_jh
TestStarted
- locationHint=gotest://TestFoo/#00
- name=TestFoo/#00
TestStarted
- locationHint=gotest://TestFoo/#00#01
- name=TestFoo/#00#01
TestStarted
- locationHint=gotest://TestFoo/#01
- name=TestFoo/#01
TestStarted
- locationHint=gotest://TestFoo/Bar
- name=TestFoo/Bar
TestStarted
- locationHint=gotest://TestFoo/Bar/Buzz2
- name=TestFoo/Bar/Buzz2
TestStarted
- locationHint=gotest://TestFoo/Bar/Buzz2#01
- name=TestFoo/Bar/Buzz2#01
TestStarted
- locationHint=gotest://TestFoo/Bar#01
- name=TestFoo/Bar#01
TestStarted
- locationHint=gotest://TestFoo/Bar#01/Buzz2
- name=TestFoo/Bar#01/Buzz2
TestStarted
- locationHint=gotest://TestFoo/Bar#01/Buzz2#01
- name=TestFoo/Bar#01/Buzz2#01
TestFinished
- duration=42
- name=TestFoo
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/k[h]kjh_khk_jh
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/#00
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/#00#01
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/#01
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/Bar
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/Bar/Buzz2
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/Bar/Buzz2#01
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/Bar#01
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/Bar#01/Buzz2
TestStdOut
- name=TestFoo/Bar#01/Buzz2#01
- out=
TestFinished
- duration=42
- name=TestFoo/Bar#01/Buzz2#01
24 changes: 24 additions & 0 deletions testData/testing/gotest/subTests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
=== RUN TestFoo
=== RUN TestFoo/k[h]kjh_khk_jh
=== RUN TestFoo/#00
=== RUN TestFoo/#00#01
=== RUN TestFoo/#01
=== RUN TestFoo/Bar
=== RUN TestFoo/Bar/Buzz2
=== RUN TestFoo/Bar/Buzz2#01
=== RUN TestFoo/Bar#01
=== RUN TestFoo/Bar#01/Buzz2
=== RUN TestFoo/Bar#01/Buzz2#01
--- PASS: TestFoo (0.00s)
--- PASS: TestFoo/k[h]kjh_khk_jh (0.00s)
--- PASS: TestFoo/#00 (0.00s)
--- PASS: TestFoo/#00#01 (0.00s)
--- PASS: TestFoo/#01 (0.00s)
--- PASS: TestFoo/Bar (0.00s)
--- PASS: TestFoo/Bar/Buzz2 (0.00s)
--- PASS: TestFoo/Bar/Buzz2#01 (0.00s)
--- PASS: TestFoo/Bar#01 (0.00s)
--- PASS: TestFoo/Bar#01/Buzz2 (0.00s)
--- PASS: TestFoo/Bar#01/Buzz2#01 (0.00s)
PASS
ok foo 0.010s
12 changes: 8 additions & 4 deletions tests/com/goide/runconfig/testing/GotestEventsConverterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public void testMultipleTestsOk() {
public void testSingleTestLeadingSpaceOk() {
doTest();
}

public void testSkipTest() {
doTest();
}

public void testStdOut() {
doTest();
}

public void testOneLineEvents() {
doTest();
}
Expand All @@ -56,12 +56,16 @@ public void testUnicodeTestName() {
doTest();
}

public void testSubTests() {
doTest();
}

@NotNull
@Override
protected String getBasePath() {
return "testing/gotest";
}

@NotNull
@Override
protected GoTestFramework getTestFramework() {
Expand Down
4 changes: 2 additions & 2 deletions utils/src/com/goide/GoConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class GoConstants {
public static final String GO_LIBRARIES_CONFIG_FILE = "goLibraries.xml";
public static final String GO_MODULE_SESTTINGS_SERVICE_NAME = "Go";

public static final String IDENTIFIER_REGEX = "[\\p{javaLetter}_][\\p{javaLetterOrDigit}_]*";

private static final String IDENTIFIER_REGEX = "[\\p{javaLetter}_][\\p{javaLetterOrDigit}_]*";
public static final String TEST_NAME_REGEX = IDENTIFIER_REGEX + "(/\\S*)?";
public static final String TESTDATA_NAME = "testdata";
public static final String TEST_SUFFIX = "_test";
public static final String TEST_SUFFIX_WITH_EXTENSION = "_test.go";
Expand Down

0 comments on commit 25b8b03

Please sign in to comment.