mdtoc/main_test.go

27 lines
427 B
Go
Raw Normal View History

package main
import (
"log"
"testing"
)
func TestGet_heading_level(t *testing.T) {
level := Get_heading_level("# foo")
if level < 0 || level > 6 {
log.Fatal("Level is not between 0 and 6.")
}
level = Get_heading_level("not a header")
if level != 0 {
log.Fatal("A non header should be level 0!")
}
level = Get_heading_level("#")
if level < 0 || level > 6 {
log.Fatal("Level is not between 0 and 6.")
}
}