gilo/editor/highlight/highlight_test.go
Timothy Warren 69709a1cb4
All checks were successful
timw4mail/gilo/pipeline/head This commit looks good
Highlight keywords, and fix emoji rendering issue
2023-10-05 11:03:08 -04:00

35 lines
674 B
Go

package highlight
import "testing"
func TestGetSyntaxByFilename(t *testing.T) {
var s *Syntax = nil
t.Run("returns nil on empty filename", func(t *testing.T) {
got := GetSyntaxByFilename("")
want := s
if got != want {
t.Errorf("got %q want 'nil'", got.FileType)
}
})
t.Run("returns nil on undefined file type", func(t *testing.T) {
got := GetSyntaxByFilename("foo.bar")
want := s
if got != want {
t.Errorf("got %q want 'nil'", got.FileType)
}
})
t.Run("returns c on .c file", func(t *testing.T) {
got := GetSyntaxByFilename("kilo.c")
want := "c"
if got.FileType != want {
t.Errorf("got %q want %q", got.FileType, want)
}
})
}