Convert to UK English spelling (colourization, coloured)

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-20 04:17:39 +00:00
parent aa5134e645
commit c132c32731
2 changed files with 14 additions and 14 deletions

View File

@ -566,7 +566,7 @@ func (te *tomlEncoder) colorizeToml(input []byte) []byte {
// Table sections - [section] or [[array]] // Table sections - [section] or [[array]]
// Only treat '[' as a table section if it appears at the start of the line // Only treat '[' as a table section if it appears at the start of the line
// (possibly after whitespace). This avoids mis-coloring inline arrays like // (possibly after whitespace). This avoids mis-colouring inline arrays like
// "ports = [8000, 8001]" as table sections. // "ports = [8000, 8001]" as table sections.
if ch == '[' { if ch == '[' {
isSectionHeader := true isSectionHeader := true

View File

@ -628,10 +628,10 @@ func TestTomlScenarios(t *testing.T) {
documentScenarios(t, "usage", "toml", genericScenarios, documentTomlScenario) documentScenarios(t, "usage", "toml", genericScenarios, documentTomlScenario)
} }
// TestTomlColorization tests that colorization correctly distinguishes // TestTomlColourization tests that colourization correctly distinguishes
// between table section headers and inline arrays // between table section headers and inline arrays
func TestTomlColorization(t *testing.T) { func TestTomlColourization(t *testing.T) {
// Test that inline arrays are not colored as table sections // Test that inline arrays are not coloured as table sections
encoder := &tomlEncoder{prefs: TomlPreferences{ColorsEnabled: true}} encoder := &tomlEncoder{prefs: TomlPreferences{ColorsEnabled: true}}
// Create TOML with both table sections and inline arrays // Create TOML with both table sections and inline arrays
@ -647,15 +647,15 @@ alpha = "test"
resultStr := string(result) resultStr := string(result)
// The bug would cause the inline array [8000, 8001, 8002] to be // The bug would cause the inline array [8000, 8001, 8002] to be
// colored with the section color (Yellow + Bold) instead of being // coloured with the section colour (Yellow + Bold) instead of being
// left uncolored or colored differently. // left uncoloured or coloured differently.
// //
// To test this, we check that the section color codes appear only // To test this, we check that the section colour codes appear only
// for actual table sections, not for inline arrays. // for actual table sections, not for inline arrays.
// Get the ANSI codes for section color (Yellow + Bold) // Get the ANSI codes for section colour (Yellow + Bold)
sectionColor := color.New(color.FgYellow, color.Bold).SprintFunc() sectionColour := color.New(color.FgYellow, color.Bold).SprintFunc()
sampleSection := sectionColor("[database]") sampleSection := sectionColour("[database]")
// Extract just the ANSI codes from the sample // Extract just the ANSI codes from the sample
// ANSI codes start with \x1b[ // ANSI codes start with \x1b[
@ -674,14 +674,14 @@ alpha = "test"
} }
} }
// Count how many times the section color appears in the output // Count how many times the section colour appears in the output
// It should appear exactly twice: once for [database] and once for [servers] // It should appear exactly twice: once for [database] and once for [servers]
// If it appears more times (e.g., for [8000, 8001, 8002]), that's the bug // If it appears more times (e.g., for [8000, 8001, 8002]), that's the bug
sectionColorCount := strings.Count(resultStr, ansiStart) sectionColourCount := strings.Count(resultStr, ansiStart)
// We expect exactly 2 occurrences (for [database] and [servers]) // We expect exactly 2 occurrences (for [database] and [servers])
// The bug would cause more occurrences (e.g., also for [8000) // The bug would cause more occurrences (e.g., also for [8000)
if sectionColorCount != 2 { if sectionColourCount != 2 {
t.Errorf("Expected section color to appear exactly 2 times (for [database] and [servers]), but it appeared %d times.\nOutput: %s", sectionColorCount, resultStr) t.Errorf("Expected section colour to appear exactly 2 times (for [database] and [servers]), but it appeared %d times.\nOutput: %s", sectionColourCount, resultStr)
} }
} }