{"record":{"id":"609a37ff9d221091","repo":"kovidgoyal/kitty","slug":"d-out-of-d-tests-failed","errorCode":null,"errorMessage":"%d out of %d tests failed.","messagePattern":"(.+?) out of (.+?) tests failed\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"tools/cli/wcswidth_kitten.go","lineNumber":174,"sourceCode":"\tfor _, t := range tests {\n\t\tdiff := \"\"\n\t\tif t.tester == nil {\n\t\t\tac := make([]int, len(t.actual_cursor_positions))\n\t\t\tfor i, cp := range t.actual_cursor_positions {\n\t\t\t\tac[i] = cp.x\n\t\t\t}\n\t\t\tdiff = cmp.Diff(t.expected_cursor_positions, ac)\n\t\t} else {\n\t\t\tdiff = t.tester(t.actual_cursor_positions, screen_width)\n\t\t}\n\t\tif diff != \"\" {\n\t\t\tfmt.Printf(\"\\x1b[31mTest number %d failed\\x1b[39m: %s\\n\", t.num, t.description)\n\t\t\tfmt.Println(diff)\n\t\t\tnum_failures++\n\t\t}\n\t}\n\tif num_failures > 0 {\n\t\terr = fmt.Errorf(\"%d out of %d tests failed.\", num_failures, len(tests))\n\t} else {\n\t\tfmt.Println(\"All tests passed!\")\n\t}\n\treturn\n}\n\nfunc has_control_chars(text string) bool {\n\tfor _, ch := range text {\n\t\tif ch < ' ' {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc create_tests(gb_tests []kitty.GraphemeBreakTest, width_in_cells int) (tests []*test_struct) {\n\tfor _, t := range gb_tests {\n\t\ttext := strings.Join(t.Data, \"\")","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/tools/cli/wcswidth_kitten.go#L156-L192","documentation":"This is the wcswidth kitten's summary failure: after printing per-test diffs, one or more of the terminal's measured character cell widths did not match the expected GraphemeBreakTest-derived widths. It indicates the terminal's text shaping/width calculation differs from Unicode expectations.","triggerScenarios":"show_results iterates the tests; any test whose rendered width on screen differs from the expected width increments num_failures, and the function returns this aggregated error.","commonSituations":"Terminals with buggy or incomplete Unicode 9+ wide-character handling, fonts that render double-width glyphs in single cells, emoji width disagreements, or older terminals predating modern grapheme clustering.","solutions":["Run the kitten inside kitty itself, where widths are known-correct","Update your terminal emulator to a version with current Unicode width tables","Report the failing test numbers and description to your terminal's issue tracker","Verify the locale (LC_CTYPE) is UTF-8, not C/POSIX"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := show_results(tests, w); err != nil { /* treat as advisory; inspect per-test diffs printed above */ }","preventionTips":["Treat the kitten as a diagnostic tool; failures indicate terminal bugs, not kitty bugs","Note failing test numbers for upstream reports"],"tags":["kitty","unicode","wcwidth","testing"],"backgroundTag":"unicode-width-mismatch","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}