-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (31 loc) · 759 Bytes
/
main.go
File metadata and controls
37 lines (31 loc) · 759 Bytes
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
package main
import (
"bytes"
"io"
"os"
tap "github.com/opencontainers/runtime-tools/util/tap"
)
func main() {
// collect output for comparison later
buf := new(bytes.Buffer)
t := tap.New()
t.Writer = io.MultiWriter(os.Stdout, buf)
t.Header(1)
t.Diagnostic("expecting all to be well")
t.Diagnosticf("here's some perfectly magical output: %d %s 0x%X.", 6, "abracadabra", 28)
t.Diagnostic("some\nmultiline\ntext\n")
t.Diagnosticf("%d lines\n%s multiline\ntext", 3, "more")
got := buf.String()
t.Ok(got == expected, "diagnostics gave expected output")
}
const expected = `TAP version 13
1..1
# expecting all to be well
# here's some perfectly magical output: 6 abracadabra 0x1C.
# some
# multiline
# text
# 3 lines
# more multiline
# text
`