blob: a742166b7e5b48ef206501d93aaf2ee8cc11089b (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
package com.iinteractive.test
import java.io.ByteArrayOutputStream
import com.iinteractive.test.tap.Parser
class FormattingTest extends TestMore {
val lineZero = Thread.currentThread.getStackTrace()(1).getLineNumber + 3
def line (offset: Int) = lineZero + offset
private class FormattingTestTest extends TestMore {
is(1, 1, "newlines\nwork")
is(1, 2, "newlines\nwork")
diag("newlines\nwork")
note("newlines\nwork")
is(1, 1, "\nnewlines\n")
is(1, 2, "\nnewlines\n")
diag("\nnewlines\n")
note("\nnewlines\n")
}
val out = new ByteArrayOutputStream
val exitCode = Console.withOut(out) {
Console.withErr(out) {
(new FormattingTestTest).run
}
}
is((new Parser).parse(out).exitCode, 2)
is(exitCode, 2)
val tap =
"ok 1 - newlines\n" +
"# work\n" +
"not ok 2 - newlines\n" +
"# work\n" +
"# Failed test 'newlines\n" +
"# work'\n" +
"# at FormattingTest.scala line " + line(2) + ".\n" +
"# got: '1'\n" +
"# expected: '2'\n" +
"# newlines\n" +
"# work\n" +
"# newlines\n" +
"# work\n" +
"ok 3 - \n" +
"# newlines\n" +
"# \n" +
"not ok 4 - \n" +
"# newlines\n" +
"# \n" +
"# Failed test '\n" +
"# newlines\n" +
"# '\n" +
"# at FormattingTest.scala line " + line(8) + ".\n" +
"# got: '1'\n" +
"# expected: '2'\n" +
"# \n" +
"# newlines\n" +
"# \n" +
"# newlines\n" +
"1..4\n" +
"# Looks like you failed 2 tests of 4.\n"
is(out.toString, tap)
}
|