added scheme and kotlin to code_search

This commit is contained in:
Dhanji R. Prasanna
2025-11-05 14:17:15 +11:00
parent 26e26cf367
commit 4327c839a9
7 changed files with 99 additions and 2 deletions

View File

@@ -549,3 +549,28 @@ async fn test_cpp_search() {
.collect();
assert!(names.contains(&"Person"));
}
#[tokio::test]
async fn test_kotlin_search() {
let request = CodeSearchRequest {
searches: vec![SearchSpec {
name: "kotlin_classes".to_string(),
query: "(class_declaration (type_identifier) @name)".to_string(),
language: "kotlin".to_string(),
paths: vec!["examples/test_code".to_string()],
context_lines: 0,
}],
max_concurrency: 4,
max_matches_per_search: 500,
};
let response = execute_code_search(request).await.unwrap();
assert_eq!(response.searches.len(), 1);
assert!(response.searches[0].matches.len() > 0);
// Should find Person class
let names: Vec<&str> = response.searches[0].matches.iter()
.filter_map(|m| m.captures.get("name").map(|s| s.as_str()))
.collect();
assert!(names.contains(&"Person"));
}