Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const DefaultTAPVersion = 12
DefaultTAPVersion is default TAP version.
Variables ¶
View Source
var ErrUnsupportedVersion = errors.New("tap: unsupported version")
ErrUnsupportedVersion is an error for unsupported TAP version.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is a TAP parser.
func NewParser ¶
NewParser creates a new Parser.
Example ¶
r := strings.NewReader(`1..3
ok 1 hogehoge
not ok foobar
# Doesn't wiggle
not ok 3 foobar # TODO not implemented yet`)
p, err := NewParser(r)
if err != nil {
panic(err)
}
suite, err := p.Suite()
if err != nil {
panic(err)
}
if suite.Ok {
fmt.Println("Everything ok")
return
}
for _, t := range suite.Tests {
fmt.Println(t)
}
Output: ok 1 - hogehoge not ok 2 - foobar not ok 3 - foobar # TODO not implemented yet
type Testline ¶
type Testline struct {
Ok bool // Whether the Testpoint executed ok
Num int // The number of the test
Description string // A short description
Directive Directive // Whether the test was skipped or is a todo
Explanation string // A short explanation why the test was skipped/is a todo
Diagnostic string // A more detailed diagnostic message about the failed test
Time time.Duration // Time it took to test
YAML []byte // The inline YAML-document, if given
SubTests []*Testline // Sub-Tests
}
Testline is a single TAP-Testline.
func (*Testline) GoString ¶
GoString returns the detail of the test result.
Example ¶
r := strings.NewReader(`TAP version 13
ok 1 - foo
# Subtest: bar
# Subtest: subtest1
ok 1 - subsubtest1
ok 2 - subsubtest2 # TODO not implemented yet
# note message for subsubtest2
ok 3 - subsubtest3
1..3
ok 1 - subtest1
1..1
ok 2 - bar
ok 3 - foobar
---
- foo
- bar
...
1..3
`)
p, err := NewParser(r)
if err != nil {
panic(err)
}
suite, err := p.Suite()
if err != nil {
panic(err)
}
for _, t := range suite.Tests {
fmt.Printf("%#v", t)
}
Output: ok 1 - foo # Subtest: bar # Subtest: subtest1 ok 1 - subsubtest1 ok 2 - subsubtest2 # TODO not implemented yet # note message for subsubtest2 ok 3 - subsubtest3 1..3 ok 1 - subtest1 1..1 ok 2 - bar ok 3 - foobar --- - foo - bar ...
type Testsuite ¶
type Testsuite struct {
Ok bool // Whether the Testsuite as a whole succeeded
Tests []*Testline // Description of all Testlines
Plan int // Number of tests intended to run (-1 means no plan)
Version int // version number of TAP
Time time.Duration // Time it took to test
}
Testsuite is the outcome of a Testsuite
Click to show internal directories.
Click to hide internal directories.