diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 299cc443d..eede70e58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,7 +121,7 @@ jobs: run: which python && python -m mypy --version && ./test.py mypy - name: Run go vet - run: cp kitty_tests/GraphemeBreakTest.json tools/wcswidth && go version && go vet ./... + run: go version && go vet -tags testing ./... - name: Build man page run: make FAIL_WARN=1 man diff --git a/.gitignore b/.gitignore index 8870a3434..b3609e1a0 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,6 @@ __pycache__/ /docs/_build/ /docs/generated/ /tools/simdstring/simdstring.test -/tools/wcswidth/GraphemeBreakTest.json /.mypy_cache /.ruff_cache .DS_Store diff --git a/kitty_tests/main.py b/kitty_tests/main.py index 2f10b2eb4..9fb569cb4 100644 --- a/kitty_tests/main.py +++ b/kitty_tests/main.py @@ -180,11 +180,10 @@ class GoProc(Thread): def run_go(packages: set[str], names: str) -> GoProc: go = go_exe() go_pkg_args = [f'kitty/{x}' for x in packages] - cmd = [go, 'test', '-v'] + cmd = [go, 'test', '--tags', 'testing', '-v'] for name in names: cmd.extend(('-run', name)) cmd += go_pkg_args - shutil.copy2('kitty_tests/GraphemeBreakTest.json', 'tools/wcswidth/GraphemeBreakTest.json') return GoProc(cmd) diff --git a/testing_exports.go b/testing_exports.go new file mode 100644 index 000000000..b6741d086 --- /dev/null +++ b/testing_exports.go @@ -0,0 +1,13 @@ +//go:build testing + +package kitty + +import ( + _ "embed" + "fmt" +) + +var _ = fmt.Print + +//go:embed kitty_tests/GraphemeBreakTest.json +var GraphemeBreakTestData []byte diff --git a/tools/wcswidth/char-props_test.go b/tools/wcswidth/char-props_test.go index 4e12980e6..bc3d3bbca 100644 --- a/tools/wcswidth/char-props_test.go +++ b/tools/wcswidth/char-props_test.go @@ -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 {