Skip to content
quarry Artifact [8a0eafcff9]
Login

Artifact [8a0eafcff9]

Artifact 8a0eafcff9c1b1ff32d98aaa398241bb0347f3dd87d64cb45cc66852f1b60feb:


package artifact

import "testing"

// Fossil: leading whitespace (space, \t..\r) is skipped, and a page with
// nothing after it is deleted (manifest.c, manifest_crosslink).
func TestWikiDeletedFollowsFossilsRule(t *testing.T) {
	for _, c := range []struct {
		body string
		want bool
	}{
		{"", true}, {" ", true}, {"\n", true}, {" \t\n\v\f\r ", true},
		{"x", false}, {"  x", false}, {"\n\nx\n", false}, {" ", false}, {"\x00", false}, {"\x1f", false},
	} {
		if got := WikiDeleted([]byte(c.body)); got != c.want {
			t.Errorf("FAIL: WikiDeleted(%q) = %v, want %v", c.body, got, c.want)
		}
	}
	if !t.Failed() {
		t.Log("ok")
	}
}