crates/agent2/src/agent2.rs 🔗
@@ -3,4 +3,7 @@ mod templates;
mod thread;
mod tools;
+#[cfg(test)]
+mod tests;
+
pub use thread::*;
Nathan Sobo created
- Move tests from thread/tests.rs to tests/mod.rs
- Move test_tools from thread/tests/test_tools.rs to tests/test_tools.rs
- Update imports and fix compilation errors in tests
- Fix private field access by using public messages() method
- Add necessary imports for test modules
crates/agent2/src/agent2.rs | 3 +++
crates/agent2/src/tests/mod.rs | 9 +++++----
crates/agent2/src/tests/test_tools.rs | 2 ++
3 files changed, 10 insertions(+), 4 deletions(-)
@@ -3,4 +3,7 @@ mod templates;
mod thread;
mod tools;
+#[cfg(test)]
+mod tests;
+
pub use thread::*;
@@ -1,5 +1,6 @@
use super::*;
-use client::{proto::language_server_prompt_request, Client, UserStore};
+use crate::templates::Templates;
+use client::{Client, UserStore};
use fs::FakeFs;
use gpui::{AppContext, Entity, TestAppContext};
use language_model::{
@@ -27,7 +28,7 @@ async fn test_echo(cx: &mut TestAppContext) {
.await;
agent.update(cx, |agent, _cx| {
assert_eq!(
- agent.messages.last().unwrap().content,
+ agent.messages().last().unwrap().content,
vec![MessageContent::Text("Hello".to_string())]
);
});
@@ -74,7 +75,7 @@ async fn test_basic_tool_calls(cx: &mut TestAppContext) {
);
agent.update(cx, |agent, _cx| {
assert!(agent
- .messages
+ .messages()
.last()
.unwrap()
.content
@@ -170,7 +171,7 @@ async fn test_concurrent_tool_calls(cx: &mut TestAppContext) {
}
agent.update(cx, |agent, _cx| {
- let last_message = agent.messages.last().unwrap();
+ let last_message = agent.messages().last().unwrap();
let text = last_message
.content
.iter()
@@ -1,4 +1,6 @@
use super::*;
+use anyhow::Result;
+use gpui::{App, SharedString, Task};
/// A tool that echoes its input
#[derive(JsonSchema, Serialize, Deserialize)]