Skip to content

add unit tests#1

Merged
cezary17 merged 5 commits intomainfrom
claude/add-unit-tests-QzTSy
Mar 17, 2026
Merged

add unit tests#1
cezary17 merged 5 commits intomainfrom
claude/add-unit-tests-QzTSy

Conversation

@cezary17
Copy link
Copy Markdown
Owner

Adding unit tests and changing ambiguous responses when passing in bad query parameters

claude and others added 5 commits March 17, 2026 14:49
Tests cover: single/multiple result parsing, top_k limiting, empty HTML,
whitespace normalization, missing href fallback, mismatched links/snippets
zip behavior, and top_k zero edge case.

https://claude.ai/code/session_01RCPTr5eo8aMs3NvG5h9YrG
- DuckDuckGoEngine::new() rejects empty/whitespace-only queries
- parse_results() rejects top_k of zero
- Introduces SearchError enum with EmptyQuery, InvalidTopK, Http variants
- Updates main.rs to handle the new Result return types
- Adds tests for both validation cases

https://claude.ai/code/session_01RCPTr5eo8aMs3NvG5h9YrG
Instead of silently exiting with empty output, prints
"no results found for query" to stderr and exits with code 1.

https://claude.ai/code/session_01RCPTr5eo8aMs3NvG5h9YrG
Splits InvalidTopK into TopKTooLow (zero) and TopKTooHigh (>100)
so users get a clear message for either invalid direction.

https://claude.ai/code/session_01RCPTr5eo8aMs3NvG5h9YrG
@cezary17 cezary17 merged commit 4066150 into main Mar 17, 2026
1 check passed
@cezary17 cezary17 deleted the claude/add-unit-tests-QzTSy branch March 17, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants