forked from alecthomas/chroma
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembedded_test.go
More file actions
26 lines (23 loc) · 759 Bytes
/
Copy pathembedded_test.go
File metadata and controls
26 lines (23 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package styles
import (
"strings"
"testing"
"github.com/alecthomas/assert/v2"
"github.com/alecthomas/chroma/v3"
)
// TestEmbeddedStyleNamesMatchFilenames verifies that every embedded style
// parses and is stored in a file named after its lowercased style name. The
// lazy filename-based lookup in this package depends on this invariant.
func TestEmbeddedStyleNamesMatchFilenames(t *testing.T) {
names := embeddedNames()
assert.True(t, len(names) > 0)
for _, name := range names {
f, err := embedded.Open(name + ".xml")
assert.NoError(t, err)
style, err := chroma.NewXMLStyle(f)
_ = f.Close()
assert.NoError(t, err)
assert.Equal(t, name, strings.ToLower(style.Name),
"%s.xml: file name must be the lowercased style name", name)
}
}