feat: add Google code retrieval across desktop CLI and MCP
Core CI / core (macos-latest) (push) Canceled after 0s
Core CI / core (windows-latest) (push) Canceled after 0s
Core CI / desktop (macos-latest) (push) Canceled after 0s
Core CI / desktop (ubuntu-latest) (push) Canceled after 0s
Core CI / desktop (windows-latest) (push) Canceled after 0s
Core CI / core (ubuntu-latest) (push) Canceled after 2m23s
Core CI / core (macos-latest) (push) Canceled after 0s
Core CI / core (windows-latest) (push) Canceled after 0s
Core CI / desktop (macos-latest) (push) Canceled after 0s
Core CI / desktop (ubuntu-latest) (push) Canceled after 0s
Core CI / desktop (windows-latest) (push) Canceled after 0s
Core CI / core (ubuntu-latest) (push) Canceled after 2m23s
This commit is contained in:
1 parent
8b9b079469
commit
81846b3e98
32 files changed
+1303
-59
No files matched your search
@@ -157,3 +157,55 @@ fn exclusions_and_filters_change_real_results() {
|
||||
let stats: serde_json::Value = serde_json::from_slice(&stats.stdout).unwrap();
|
||||
assert_eq!(stats["files"], 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn code_only_filters_real_results_and_finds_exact_symbols() {
|
||||
let fixture = Fixture::new();
|
||||
fs::create_dir(fixture.0.join("code")).unwrap();
|
||||
fs::write(
|
||||
fixture.0.join("code/retry.rs"),
|
||||
"pub fn refreshAccessToken() { /* retry failed requests with backoff */ }",
|
||||
)
|
||||
.unwrap();
|
||||
fs::write(
|
||||
fixture.0.join("code/notes.txt"),
|
||||
"refreshAccessToken retry failed requests with backoff",
|
||||
)
|
||||
.unwrap();
|
||||
let indexed = fixture.run(&["index", "--db", "index.db", "--root", "code"]);
|
||||
assert!(
|
||||
indexed.status.success(),
|
||||
"{}",
|
||||
String::from_utf8_lossy(&indexed.stderr)
|
||||
);
|
||||
let all = fixture.run(&["search", "--db", "index.db", "refreshAccessToken", "--json"]);
|
||||
assert_eq!(
|
||||
serde_json::from_slice::<serde_json::Value>(&all.stdout)
|
||||
.unwrap()
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.len(),
|
||||
2
|
||||
);
|
||||
let code = fixture.run(&[
|
||||
"search",
|
||||
"--db",
|
||||
"index.db",
|
||||
"refreshAccessToken",
|
||||
"--code-only",
|
||||
"--json",
|
||||
]);
|
||||
assert!(
|
||||
code.status.success(),
|
||||
"{}",
|
||||
String::from_utf8_lossy(&code.stderr)
|
||||
);
|
||||
let results: serde_json::Value = serde_json::from_slice(&code.stdout).unwrap();
|
||||
assert_eq!(results.as_array().unwrap().len(), 1);
|
||||
assert_eq!(results[0]["filename"], "retry.rs");
|
||||
assert!(results[0]["snippet"]
|
||||
.as_str()
|
||||
.unwrap()
|
||||
.contains("refreshAccessToken"));
|
||||
assert_eq!(results[0]["source"]["kind"], "line");
|
||||
}
|
||||
Reference in new issue
Block a user