forked from getgauge/gauge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
formatter_test.go
34 lines (29 loc) · 869 Bytes
/
formatter_test.go
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
package main
import (
. "gopkg.in/check.v1"
)
func (s *MySuite) TestFormatSpecification(c *C) {
tokens := []*token{
&token{kind: specKind, value: "Spec Heading", lineNo: 1},
&token{kind: scenarioKind, value: "Scenario Heading", lineNo: 2},
&token{kind: stepKind, value: "Example step", lineNo: 3},
&token{kind: stepKind, value: "Step with inline table", lineNo: 3},
&token{kind: tableHeader, args: []string{"id", "name"}},
&token{kind: tableRow, args: []string{"1", "foo"}},
&token{kind: tableRow, args: []string{"2", "bar"}},
}
spec, _ := new(specParser).createSpecification(tokens, new(conceptDictionary))
formatted := formatSpecification(spec)
c.Assert(formatted, Equals,
`Spec Heading
============
Scenario Heading
----------------
* Example step
* Step with inline table
|id|name|
|--|----|
|1 |foo |
|2 |bar |
`)
}