Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/chat-cli/src/auth/builder_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl std::fmt::Display for OAuthFlow {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match *self {
OAuthFlow::DeviceCode => write!(f, "DeviceCode"),
OAuthFlow::Pkce => write!(f, "PKCE"),
OAuthFlow::Pkce => write!(f, "Pkce"),
}
}
}
Expand Down Expand Up @@ -593,7 +593,7 @@ mod tests {
#[test]
fn test_oauth_flow_ser_deser() {
test_ser_deser!(OAuthFlow, OAuthFlow::DeviceCode, "DeviceCode");
test_ser_deser!(OAuthFlow, OAuthFlow::Pkce, "PKCE");
test_ser_deser!(OAuthFlow, OAuthFlow::Pkce, "Pkce");
}

#[test]
Expand Down
1 change: 0 additions & 1 deletion crates/chat-cli/src/auth/secret_store/sqlite.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(dead_code)]
use super::Secret;
use crate::Result;
use crate::auth::AuthError;
use crate::settings::sqlite::{
Db,
Expand Down
2 changes: 1 addition & 1 deletion crates/chat-cli/src/cli/chat/conversation_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ mod tests {

#[tokio::test]
async fn test_conversation_state_additional_context() {
tracing_subscriber::fmt::try_init().ok();
// tracing_subscriber::fmt::try_init().ok();

let mut tool_manager = ToolManager::default();
let ctx = Context::builder().with_test_home().await.unwrap().build_fake();
Expand Down
8 changes: 4 additions & 4 deletions crates/chat-cli/src/cli/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3384,7 +3384,7 @@ mod tests {

#[tokio::test]
async fn test_flow() {
let _ = tracing_subscriber::fmt::try_init();
// let _ = tracing_subscriber::fmt::try_init();
let ctx = Context::builder().with_test_home().await.unwrap().build_fake();
let test_client = create_stream(serde_json::json!([
[
Expand Down Expand Up @@ -3438,7 +3438,7 @@ mod tests {

#[tokio::test]
async fn test_flow_tool_permissions() {
let _ = tracing_subscriber::fmt::try_init();
// let _ = tracing_subscriber::fmt::try_init();
let ctx = Context::builder().with_test_home().await.unwrap().build_fake();
let test_client = create_stream(serde_json::json!([
[
Expand Down Expand Up @@ -3584,7 +3584,7 @@ mod tests {

#[tokio::test]
async fn test_flow_multiple_tools() {
let _ = tracing_subscriber::fmt::try_init();
// let _ = tracing_subscriber::fmt::try_init();
let ctx = Context::builder().with_test_home().await.unwrap().build_fake();
let test_client = create_stream(serde_json::json!([
[
Expand Down Expand Up @@ -3678,7 +3678,7 @@ mod tests {

#[tokio::test]
async fn test_flow_tools_trust_all() {
let _ = tracing_subscriber::fmt::try_init();
// let _ = tracing_subscriber::fmt::try_init();
let ctx = Context::builder().with_test_home().await.unwrap().build_fake();
let test_client = create_stream(serde_json::json!([
[
Expand Down
2 changes: 1 addition & 1 deletion crates/chat-cli/src/cli/chat/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ mod tests {

#[tokio::test]
async fn test_parse() {
let _ = tracing_subscriber::fmt::try_init();
// let _ = tracing_subscriber::fmt::try_init();
let tool_use_id = "TEST_ID".to_string();
let tool_name = "execute_bash".to_string();
let tool_args = serde_json::json!({
Expand Down
2 changes: 1 addition & 1 deletion crates/chat-cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const HELP_TEXT: &str = color_print::cstr! {"
"};

#[derive(Debug, Parser, PartialEq, Default)]
#[command(version, about, name = crate::CHAT_BINARY_NAME, help_template = HELP_TEXT)]
#[command(version, about, name = crate::util::CHAT_BINARY_NAME, help_template = HELP_TEXT)]
pub struct Cli {
#[command(subcommand)]
pub subcommand: Option<CliRootCommands>,
Expand Down
1 change: 1 addition & 0 deletions crates/chat-cli/src/mcp_client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ mod tests {
PathBuf::from(workspace_root)
}

#[ignore = "TODO: support test binary"]
#[tokio::test(flavor = "multi_thread")]
async fn test_client_stdio() {
std::process::Command::new("cargo")
Expand Down
7 changes: 2 additions & 5 deletions crates/chat-cli/src/platform/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ mod inner {

impl Env {
pub fn new() -> Self {
match cfg!(test) {
true => Self(inner::Inner::Fake(Arc::new(Mutex::new(inner::Fake::default())))),
false => Self::default(),
}
Self::default()
}

/// Create a fake process environment from a slice of tuples.
Expand Down Expand Up @@ -213,7 +210,7 @@ mod tests {

#[test]
fn test_default_current_dir() {
let env = Env::new();
let env = Env::from_slice(&[]);
assert_eq!(env.current_dir().unwrap(), PathBuf::from("/"));
}
}
7 changes: 2 additions & 5 deletions crates/chat-cli/src/platform/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ mod inner {

impl Fs {
pub fn new() -> Self {
match cfg!(test) {
true => Self(inner::Inner::Fake(Arc::new(Mutex::new(HashMap::new())))),
false => Self::default(),
}
Self::default()
}

pub fn new_chroot() -> Self {
Expand Down Expand Up @@ -484,7 +481,7 @@ mod tests {

#[tokio::test]
async fn test_read_to_string() {
let fs = Fs::new();
let fs = Fs::new_chroot();
fs.write("fake", "contents").await.unwrap();
fs.write("invalid_utf8", &[255]).await.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion crates/chat-cli/src/settings/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ mod tests {
);

// Assert all the files in migrations/ are in the list
let migration_folder = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/sqlite/migrations");
let migration_folder = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/settings/sqlite_migrations");
let migration_count = std::fs::read_dir(migration_folder).unwrap().count();
assert_eq!(MIGRATIONS.len(), migration_count);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/chat-cli/src/util/directories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub fn runtime_dir() -> Result<PathBuf> {
pub fn logs_dir() -> Result<PathBuf> {
cfg_if::cfg_if! {
if #[cfg(unix)] {
use crate::CHAT_BINARY_NAME;
use crate::util::CHAT_BINARY_NAME;
Ok(runtime_dir()?.join(format!("{CHAT_BINARY_NAME}log")))
} else if #[cfg(windows)] {
Ok(std::env::temp_dir().join("amazon-q").join("logs"))
Expand Down
Loading