Skip to content

Commit

Permalink
Add test case for increasing coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Dec 22, 2019
1 parent c3aed0f commit 6995f1d
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions printer/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ text3: ffff
hhhh
iiii
jjjj
bool: true
number: 10
anchor: &x 1
alias: *x
`
t.Run("print starting from tokens[3]", func(t *testing.T) {
tokens := lexer.Tokenize(yml)
Expand Down Expand Up @@ -74,14 +78,27 @@ text3: ffff
9 | gggg
10 | hhhh
11 | iiii
12 | jjjj`
12 | jjjj
13 | `
if actual != expect {
t.Fatalf("unexpected output: expect:[%s]\n actual:[%s]", expect, actual)
}
})
t.Run("output with color", func(t *testing.T) {
tokens := lexer.Tokenize(yml)
var p printer.Printer
t.Logf("%s", p.PrintErrorToken(tokens[6], true))
t.Run("token6", func(t *testing.T) {
tokens := lexer.Tokenize(yml)
var p printer.Printer
t.Logf("%s", p.PrintErrorToken(tokens[6], true))
})
t.Run("token9", func(t *testing.T) {
tokens := lexer.Tokenize(yml)
var p printer.Printer
t.Logf("%s", p.PrintErrorToken(tokens[9], true))
})
t.Run("token12", func(t *testing.T) {
tokens := lexer.Tokenize(yml)
var p printer.Printer
t.Logf("%s", p.PrintErrorToken(tokens[12], true))
})
})
}

0 comments on commit 6995f1d

Please sign in to comment.