Skip to content
quarry Artifact [c203466bac]
Login

Artifact [c203466bac]

Artifact c203466bac1e5d1492ee1dba81be0175dfd96af09cc6c2890205bf993a185a83:


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",
		"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")
}