1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 11:46:16 +00:00
mycorrhiza/markup/xclusion_test.go
2020-10-30 18:25:48 +05:00

23 lines
738 B
Go

package markup
import (
"testing"
)
func TestParseTransclusion(t *testing.T) {
check := func(line string, expectedXclusion Transclusion) {
if xcl := parseTransclusion(line, "t"); xcl != expectedXclusion {
t.Error(line, "; got:", xcl, "wanted:", expectedXclusion)
}
}
check("<= ", Transclusion{"", -9, -9})
check("<=hypha", Transclusion{"hypha", 0, 0})
check("<= hypha\t", Transclusion{"hypha", 0, 0})
check("<= hypha :", Transclusion{"hypha", 0, 0})
check("<= hypha : ..", Transclusion{"hypha", 0, 0})
check("<= hypha : 3", Transclusion{"hypha", 3, 3})
check("<= hypha : 3..", Transclusion{"hypha", 3, 0})
check("<= hypha : ..3", Transclusion{"hypha", 0, 3})
check("<= hypha : 3..4", Transclusion{"hypha", 3, 4})
}