mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 01:38:02 +02:00
Nicer way to include grapheme test data in Go tests
This commit is contained in:
@@ -8,13 +8,12 @@ import (
|
||||
|
||||
_ "embed"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"kitty"
|
||||
)
|
||||
|
||||
var _ = fmt.Print
|
||||
|
||||
//go:embed GraphemeBreakTest.json
|
||||
var test_data []byte
|
||||
|
||||
type GraphemeBreakTest struct {
|
||||
Data []string `json:"data"`
|
||||
Comment string `json:"comment"`
|
||||
@@ -31,7 +30,7 @@ func TestSplitIntoGraphemes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
tests := []GraphemeBreakTest{}
|
||||
if err := json.Unmarshal(test_data, &tests); err != nil {
|
||||
if err := json.Unmarshal(kitty.GraphemeBreakTestData, &tests); err != nil {
|
||||
t.Fatalf("Failed to parse GraphemeBreakTest JSON with error: %s", err)
|
||||
}
|
||||
for i, x := range tests {
|
||||
|
||||
Reference in New Issue
Block a user