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()insrc/lib.rsto 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!