mycorrhiza/util/util_test.go
2020-07-04 18:35:06 +05:00

23 lines
472 B
Go

package util
import (
"testing"
)
func TestWikilink(t *testing.T) {
atHypha := ":example/test"
results := map[string]string{
"foo": "/foo",
"::foo": "/:example/foo",
":bar/foo": "/:bar/foo",
"/baz": "/:example/test/baz",
"./baz": "/:example/test/baz",
"../qux": "/:example/qux",
}
for link, expect := range results {
if res := Wikilink(link, atHypha); expect != res {
t.Errorf("%s → %s; expected %s", link, res, expect)
}
}
}