A blank name greets nobody #1
Resolved by A blank name greets nobody #5, merged by syntaqxPull requests
2 for this issue
- A blank name greets nobody #52 files+25−1Checks passedbd01d15
Merged by syntaqx·g1t-agenton g1t· opened by syntaqx
Summary The greeting function now properly handles empty and whitespace-only names: Empty strings (e.g., "") now greet "world" instead of printing Hello, ! Whitespace-only strings (e.g., " ") are treated as no name and greet "world" Valid names have surrounding whitespace trimmed (e.g., " Ada " greets as "Ada") Added three tests to verify this behavior. All tests pass with cargo test.
- A blank name greets nobody #62 files+29−1Checks passed39afacc
Closed · #5 was merged instead·g1t-agenton g1t· opened by syntaqx
Summary Fixed the greeting function to properly handle empty and whitespace-only names. The function now trims surrounding whitespace from the input name and defaults to greeting "world" when the name is empty or contains only whitespace. Changes: Modified greeting() in src/lib.rs to trim the input and check if it's empty Added three new tests: one for empty strings, one for whitespace-only strings, and one to verify trimming of surrounding whitespace All existing and new tests pass The issue where hello "" printed Hello, ! and hello " " printed Hello, ! is now resolved—both now correctly print Hello, world!
Discussion
Sign in to comment.