TestParseWindowsLineEndings tests parsing with Windows line endings
(t *testing.T)
| 6 | |
| 7 | // TestParseWindowsLineEndings tests parsing with Windows line endings |
| 8 | func TestParseWindowsLineEndings(t *testing.T) { |
| 9 | // stub our cheatsheet content with Windows line endings |
| 10 | markdown := "---\r\nsyntax: go\r\ntags: [ test ]\r\n---\r\nTo foo the bar: baz" |
| 11 | |
| 12 | // parse the frontmatter |
| 13 | fm, text, err := parse(markdown) |
| 14 | |
| 15 | // assert expectations |
| 16 | if err != nil { |
| 17 | t.Errorf("failed to parse markdown: %v", err) |
| 18 | } |
| 19 | |
| 20 | want := "To foo the bar: baz" |
| 21 | if text != want { |
| 22 | t.Errorf("failed to parse text: want: %s, got: %s", want, text) |
| 23 | } |
| 24 | |
| 25 | want = "go" |
| 26 | if fm.Syntax != want { |
| 27 | t.Errorf("failed to parse syntax: want: %s, got: %s", want, fm.Syntax) |
| 28 | } |
| 29 | } |