summaryrefslogtreecommitdiffstats
path: root/parser/frontmatter_test.go
blob: 33db0a24a16d4c834de8dbc1db19ff6a8aa07d84 (plain)
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
package parser

import (
	"testing"
)

func TestFormatToLeadRune(t *testing.T) {
	for i, this := range []struct {
		kind   string
		expect rune
	}{
		{"yaml", '-'},
		{"yml", '-'},
		{"toml", '+'},
		{"json", '{'},
		{"js", '{'},
		{"unknown", '+'},
	} {
		result := FormatToLeadRune(this.kind)

		if result != this.expect {
			t.Errorf("[%d] Got %q but expected %q", i, result, this.expect)
		}
	}
}