1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 13:30:26 +00:00
mycorrhiza/markup/xclusion_test.go

23 lines
738 B
Go
Raw Normal View History

2020-10-30 13:25:48 +00:00
package markup
import (
"testing"
)
func TestParseTransclusion(t *testing.T) {
check := func(line string, expectedXclusion Transclusion) {
2020-10-30 13:25:48 +00:00
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})
}