(t *testing.T)
| 305 | } |
| 306 | |
| 307 | func TestExtractFrontmatter_NoFrontmatter(t *testing.T) { |
| 308 | content := []byte("Just plain content") |
| 309 | |
| 310 | frontmatter, body, err := extractFrontmatter(content) |
| 311 | if err != nil { |
| 312 | t.Fatalf("expected no error, got: %v", err) |
| 313 | } |
| 314 | |
| 315 | if len(frontmatter) != 0 { |
| 316 | t.Error("expected empty frontmatter") |
| 317 | } |
| 318 | |
| 319 | if body != "Just plain content" { |
| 320 | t.Errorf("expected body to be full content, got '%s'", body) |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | func TestExtractFrontmatter_WithWhitespace(t *testing.T) { |
| 325 | content := []byte(`--- |
nothing calls this directly
no test coverage detected