aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/scala/org/perl8/test/harness/TAPReporter.scala
blob: 574dd39bfd339e442bff3b2d6e57bf84b562593f (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
package org.perl8.test.harness

import java.io.ByteArrayOutputStream

import org.perl8.test.tap
import org.perl8.test.Test
import Utils._

class TAPReporter extends Reporter {
  def run (testName: String): Int = {
    val out = new ByteArrayOutputStream
    Console.withOut(out) {
      Console.withErr(out) {
        newInstance[Test](testName).run
      }
    }

    // XXX this is wrong: it sends everything to stdout
    // need to write a tee-like outputstream to fix it
    print(out)

    val result = tap.Consumer.parse(out)
    result.exitCode
  }
}