mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Add test cases for whitespace handling for ColorList
This commit is contained in:
@ -4409,6 +4409,14 @@ pub const ColorList = struct {
|
|||||||
try p.parseCLI(alloc, "black,white");
|
try p.parseCLI(alloc, "black,white");
|
||||||
try testing.expectEqual(2, p.colors.items.len);
|
try testing.expectEqual(2, p.colors.items.len);
|
||||||
|
|
||||||
|
// Test whitespace handling
|
||||||
|
try p.parseCLI(alloc, "black, white"); // space after comma
|
||||||
|
try testing.expectEqual(2, p.colors.items.len);
|
||||||
|
try p.parseCLI(alloc, "black , white"); // spaces around comma
|
||||||
|
try testing.expectEqual(2, p.colors.items.len);
|
||||||
|
try p.parseCLI(alloc, " black , white "); // extra spaces at ends
|
||||||
|
try testing.expectEqual(2, p.colors.items.len);
|
||||||
|
|
||||||
// Error cases
|
// Error cases
|
||||||
try testing.expectError(error.ValueRequired, p.parseCLI(alloc, null));
|
try testing.expectError(error.ValueRequired, p.parseCLI(alloc, null));
|
||||||
try testing.expectError(error.InvalidValue, p.parseCLI(alloc, " "));
|
try testing.expectError(error.InvalidValue, p.parseCLI(alloc, " "));
|
||||||
|
Reference in New Issue
Block a user