Skip to content
quarry Artifact [22ba44ba15]
Login

Artifact [22ba44ba15]

Artifact 22ba44ba15421b65f5d89e2b52fea8b93d620966019de54a6546f15963a1abfe:


package api

import "testing"

// A digest quotes a chat line as prose: a link reads as its text, and
// so does an anchor a line bridged from fossil still carries.
func TestADigestQuotesLinksAsTheirWords(t *testing.T) {
	for in, want := range map[string]string{
		"see [6df13eaedc](https://f.example/r/x/info/6df13eaedc) now":                                                                       "see 6df13eaedc now",
		"(check-in: <a href='/r/libfossil/info/6df13eaedc'>6df13eaedc</a>, user: <a href='/r/libfossil/timeline?u=d&c=6df'>danshearer</a>)": "(check-in: 6df13eaedc, user: danshearer)",
		`a [b\]c](u) d`: "a b]c d",
		"<h1 class='error'>Shutting down httpd</h1>": "Shutting down httpd",
		"plain *markdown* stays":                     "plain *markdown* stays",
	} {
		if got := chatPlain(in); got != want {
			t.Errorf("FAIL: %q -> %q, want %q", in, got, want)
		}
	}
	t.Log("ok")
}