File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import org.openjdk.jmh.annotations.*
44import org .openjdk .jmh .infra .*
55import sjsonnet .*
66
7- import java .io .{OutputStream , PrintStream , StringWriter }
7+ import java .io .{OutputStream , PrintStream , ByteArrayOutputStream }
88import java .util .concurrent .TimeUnit
99
1010object RegressionBenchmark {
@@ -31,6 +31,32 @@ class RegressionBenchmark {
3131
3232 private val dummyOut = RegressionBenchmark .createDummyOut
3333
34+ @ Setup (Level .Trial )
35+ def setup (): Unit = {
36+ val baos = new ByteArrayOutputStream ()
37+ val ps = new PrintStream (baos)
38+ SjsonnetMainBase .main0(
39+ Array (path),
40+ new DefaultParseCache ,
41+ System .in,
42+ ps,
43+ System .err,
44+ RegressionBenchmark .testSuiteRoot,
45+ None
46+ )
47+ ps.close()
48+ baos.close()
49+ val golden = os.read(os.Path (path + " .golden" , RegressionBenchmark .testSuiteRoot)).stripLineEnd
50+ if (baos.toString(" UTF-8" ).stripLineEnd != golden) {
51+ System .err.println(
52+ " Golden output mismatch:\n %s != %s" .format(
53+ baos.toString(" UTF-8" ).stripLineEnd,
54+ golden
55+ )
56+ )
57+ }
58+ }
59+
3460 @ Benchmark
3561 def main (bh : Blackhole ): Unit = {
3662 bh.consume(
You can’t perform that action at this time.
0 commit comments