kovidgoyal/kitty · warning

%d out of %d tests failed.

Error message

%d out of %d tests failed.

What it means

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.

Source

Thrown at tools/cli/wcswidth_kitten.go:174

	for _, t := range tests {
		diff := ""
		if t.tester == nil {
			ac := make([]int, len(t.actual_cursor_positions))
			for i, cp := range t.actual_cursor_positions {
				ac[i] = cp.x
			}
			diff = cmp.Diff(t.expected_cursor_positions, ac)
		} else {
			diff = t.tester(t.actual_cursor_positions, screen_width)
		}
		if diff != "" {
			fmt.Printf("\x1b[31mTest number %d failed\x1b[39m: %s\n", t.num, t.description)
			fmt.Println(diff)
			num_failures++
		}
	}
	if num_failures > 0 {
		err = fmt.Errorf("%d out of %d tests failed.", num_failures, len(tests))
	} else {
		fmt.Println("All tests passed!")
	}
	return
}

func has_control_chars(text string) bool {
	for _, ch := range text {
		if ch < ' ' {
			return true
		}
	}
	return false
}

func create_tests(gb_tests []kitty.GraphemeBreakTest, width_in_cells int) (tests []*test_struct) {
	for _, t := range gb_tests {
		text := strings.Join(t.Data, "")

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Run the kitten inside kitty itself, where widths are known-correct
  2. Update your terminal emulator to a version with current Unicode width tables
  3. Report the failing test numbers and description to your terminal's issue tracker
  4. Verify the locale (LC_CTYPE) is UTF-8, not C/POSIX
Defensive patterns

Strategy: try-catch

Try / catch

if err := show_results(tests, w); err != nil { /* treat as advisory; inspect per-test diffs printed above */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/609a37ff9d221091. Report an issue: GitHub.