mdtoc/main_test.go

27 lines
381 B
Go
Raw Normal View History

package main
import (
"log"
"testing"
)
func TestGet_heading_level(t *testing.T) {
level := Get_heading_level("# foo")
2024-05-07 00:23:18 +02:00
if level != 1 {
log.Fatal("Level should be 1.")
}
level = Get_heading_level("not a header")
if level != 0 {
log.Fatal("A non header should be level 0!")
}
level = Get_heading_level("#")
2024-05-07 00:23:18 +02:00
if level != 1 {
log.Fatal("Level should be 1.")
}
}