()
| 1395 | |
| 1396 | #[test] |
| 1397 | fn test_parse_args_with_raw_args() { |
| 1398 | // Standard trailing argument gets mapped to "query" and "_0" |
| 1399 | let parsed = parse_args(&[], &["what is a witch".to_string()]).unwrap(); |
| 1400 | let obj = parsed.as_object().unwrap(); |
| 1401 | assert_eq!(obj.get("query").unwrap().as_str().unwrap(), "what is a witch"); |
| 1402 | assert_eq!(obj.get("_0").unwrap().as_str().unwrap(), "what is a witch"); |
| 1403 | |
| 1404 | // Mixture of key=value trailing args and raw positional args |
| 1405 | let parsed = parse_args( |
| 1406 | &["user=admin".to_string()], |
| 1407 | &["what is a witch".to_string(), "limit=10".to_string(), "second_arg".to_string()], |
| 1408 | ).unwrap(); |
| 1409 | let obj = parsed.as_object().unwrap(); |
| 1410 | assert_eq!(obj.get("user").unwrap().as_str().unwrap(), "admin"); |
| 1411 | assert_eq!(obj.get("query").unwrap().as_str().unwrap(), "what is a witch"); |
| 1412 | assert_eq!(obj.get("_0").unwrap().as_str().unwrap(), "what is a witch"); |
| 1413 | assert_eq!(obj.get("limit").unwrap().as_i64().unwrap(), 10); |
| 1414 | assert_eq!(obj.get("_1").unwrap().as_str().unwrap(), "second_arg"); |
| 1415 | } |
| 1416 | |
| 1417 | #[test] |
| 1418 | fn test_parse_args_raw_args_preserves_urls_with_query_params() { |
nothing calls this directly
no test coverage detected