Skip to content

Commit f2893c8

Browse files
committed
Fix parsing gotest output for benchmarks named Benchmakr
1 parent c8eb68a commit f2893c8

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

src/com/goide/runconfig/testing/frameworks/gobench/GobenchEventsConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
import java.util.regex.Pattern;
3131

3232
public class GobenchEventsConverter extends GoTestEventsConverterBaseImpl {
33-
private static final Pattern RUN = Pattern.compile("^(Benchmark" + GoConstants.IDENTIFIER_REGEX + ")");
34-
private static final Pattern FAIL = Pattern.compile("^--- FAIL: (Benchmark" + GoConstants.IDENTIFIER_REGEX + ").*");
33+
private static final Pattern RUN = Pattern.compile("^(Benchmark(" + GoConstants.TEST_NAME_REGEX + ")?)");
34+
private static final Pattern FAIL = Pattern.compile("^--- FAIL: (Benchmark(" + GoConstants.TEST_NAME_REGEX + ")?).*");
3535

3636
public GobenchEventsConverter(@NotNull TestConsoleProperties properties) {
3737
super(GobenchFramework.NAME, properties);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
TestStarted
2+
- locationHint=gotest://Benchmark
3+
- name=Benchmark
4+
TestStdOut
5+
- name=Benchmark
6+
- out=20000000 109 ns/op\n
7+
TestStdOut
8+
- name=Benchmark
9+
- out=ok github.com/cydev/stok/storage 2.311s\n
10+
TestFinished
11+
- duration=42
12+
- name=Benchmark
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PASS
2+
Benchmark 20000000 109 ns/op
3+
ok github.com/cydev/stok/storage 2.311s

tests/com/goide/runconfig/testing/GobenchEventsConverterTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public void testSuccessBenchmark() {
2424
doTest();
2525
}
2626

27+
public void testBenchmarkWithoutSuffix() {
28+
doTest();
29+
}
30+
2731
public void testFailedBenchmark() {
2832
doTest();
2933
}

0 commit comments

Comments
 (0)