From f85d1a7da25fb1d0d6491eabee2860058095fbec Mon Sep 17 00:00:00 2001 From: bep Date: Tue, 10 Mar 2015 23:17:39 +0100 Subject: parser: add some frontmatter test cases --- parser/frontmatter_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 parser/frontmatter_test.go (limited to 'parser/frontmatter_test.go') diff --git a/parser/frontmatter_test.go b/parser/frontmatter_test.go new file mode 100644 index 000000000..33db0a24a --- /dev/null +++ b/parser/frontmatter_test.go @@ -0,0 +1,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) + } + } +} -- cgit v1.2.3