Fix compiler warnings in test files

Eliminate unused variable and import warnings across test files:
- streaming_parser_test.rs: prefix unused `tools` with underscore
- webdriver_session.rs: remove unused `use super::*` import
- mock_provider_integration_test.rs: prefix unused `result` and `task_result`
- test_preflight_max_tokens.rs: prefix unused `proposed_max`
- todo_staleness_test.rs: add #[allow(dead_code)] for test helper methods
- json_parsing_stress_test.rs: prefix unused `tools`
- read_file_token_limit_test.rs: add #[allow(dead_code)] for unused helper
- background_process_demo_test.rs: remove unused PathBuf import
- test_session_continuation.rs: prefix unused `temp_dir` in 7 tests

All tests pass. No behavior changes.

Agent: fowler
This commit is contained in:
Dhanji R. Prasanna
2026-01-29 11:15:10 +11:00
parent 5c1e0630b5
commit 56f558dc1b
9 changed files with 16 additions and 15 deletions

View File

@@ -120,8 +120,6 @@ impl WebDriverSession {
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_webdriver_session_enum_variants() {
// This test just verifies the enum structure compiles correctly

View File

@@ -1,5 +1,4 @@
use g3_core::background_process::BackgroundProcessManager;
use std::path::PathBuf;
use std::thread;
use std::time::Duration;
use std::fs;

View File

@@ -164,7 +164,7 @@ fn test_json_in_indented_code_block() {
That's it."#;
let tools = parser.process_chunk(&chunk(content));
let _tools = parser.process_chunk(&chunk(content));
parser.process_chunk(&finished_chunk());
// Indented code blocks are trickier - the JSON is on its own line but indented

View File

@@ -331,7 +331,7 @@ async fn test_json_on_own_line_detected_as_tool() {
// The task should detect the tool call
// Note: This will fail because we don't have a real shell, but that's OK
// We just want to verify the tool call was detected
let result = agent.execute_task("Run echo hello", None, false).await;
let _result = agent.execute_task("Run echo hello", None, false).await;
// The result might be an error (tool execution fails in test env)
// but we can check if a tool was attempted by looking at context
@@ -408,7 +408,7 @@ async fn test_response_not_duplicated() {
assert!(result.is_ok(), "Task should succeed: {:?}", result.err());
// Check the TaskResult - it should have the response
let task_result = result.unwrap();
let _task_result = result.unwrap();
// The response field might be empty (content was streamed) or contain the response
// Either way, the context should have exactly one assistant message with this content

View File

@@ -8,6 +8,7 @@ use std::path::PathBuf;
use tempfile::TempDir;
/// Helper to create a test file with specified size
#[allow(dead_code)]
fn create_test_file(dir: &TempDir, name: &str, size_bytes: usize) -> PathBuf {
let path = dir.path().join(name);
let content: String = "x".repeat(size_bytes);

View File

@@ -75,7 +75,7 @@ fn test_first_complete_second_incomplete() {
let content = r#"{"tool": "read_file", "args": {"file_path": "a.txt"}}
{"tool": "shell", "args": {"command": "ls"#;
let tools = parser.process_chunk(&chunk(content, false));
let _tools = parser.process_chunk(&chunk(content, false));
// Should detect the first complete tool call
// The incomplete one should be detected by has_incomplete_tool_call

View File

@@ -34,7 +34,7 @@ fn test_no_thinking_budget_passes_through() {
let config = create_test_config_with_thinking(None);
// Without thinking budget, any max_tokens should be fine
let proposed_max = 5000;
let _proposed_max = 5000;
// The constraint check would return (proposed_max, false)
// since there's no thinking_budget_tokens configured

View File

@@ -125,7 +125,7 @@ fn test_find_incomplete_agent_session() {
use g3_core::session_continuation::find_incomplete_agent_session;
let _lock = TEST_MUTEX.lock().unwrap();
let (temp_dir, original_dir) = setup_test_env();
let (_temp_dir, original_dir) = setup_test_env();
// Get the actual current directory (after set_current_dir in setup)
let current_working_dir = std::env::current_dir()
@@ -165,7 +165,7 @@ fn test_find_incomplete_agent_session_ignores_complete_todos() {
use g3_core::session_continuation::find_incomplete_agent_session;
let _lock = TEST_MUTEX.lock().unwrap();
let (temp_dir, original_dir) = setup_test_env();
let (_temp_dir, original_dir) = setup_test_env();
let current_working_dir = std::env::current_dir()
.map(|p| p.to_string_lossy().to_string())
@@ -197,7 +197,7 @@ fn test_find_incomplete_agent_session_ignores_non_agent_mode() {
use g3_core::session_continuation::find_incomplete_agent_session;
let _lock = TEST_MUTEX.lock().unwrap();
let (temp_dir, original_dir) = setup_test_env();
let (_temp_dir, original_dir) = setup_test_env();
let current_working_dir = std::env::current_dir()
.map(|p| p.to_string_lossy().to_string())
@@ -227,7 +227,7 @@ fn test_find_incomplete_agent_session_ignores_non_agent_mode() {
#[test]
fn test_load_continuation_when_none_exists() {
let _lock = TEST_MUTEX.lock().unwrap();
let (temp_dir, original_dir) = setup_test_env();
let (_temp_dir, original_dir) = setup_test_env();
// No continuation should exist in a fresh temp directory
let result = load_continuation().expect("load_continuation should not error");
@@ -239,7 +239,7 @@ fn test_load_continuation_when_none_exists() {
#[test]
fn test_clear_continuation() {
let _lock = TEST_MUTEX.lock().unwrap();
let (temp_dir, original_dir) = setup_test_env();
let (_temp_dir, original_dir) = setup_test_env();
// Create and save a continuation
let continuation = SessionContinuation::new(false, None,
@@ -295,7 +295,7 @@ fn test_ensure_session_dir_creates_g3_directory() {
#[test]
fn test_has_valid_continuation_with_missing_session_log() {
let _lock = TEST_MUTEX.lock().unwrap();
let (temp_dir, original_dir) = setup_test_env();
let (_temp_dir, original_dir) = setup_test_env();
// Create a continuation pointing to a non-existent session log
let continuation = SessionContinuation::new(false, None,
@@ -347,7 +347,7 @@ fn test_has_valid_continuation_with_existing_session_log() {
#[test]
fn test_continuation_serialization_format() {
let _lock = TEST_MUTEX.lock().unwrap();
let (temp_dir, original_dir) = setup_test_env();
let (_temp_dir, original_dir) = setup_test_env();
let continuation = SessionContinuation::new(false, None,
"format_test".to_string(),

View File

@@ -22,14 +22,17 @@ impl MockUiWriter {
}
}
#[allow(dead_code)]
fn set_prompt_response(&self, response: bool) {
self.prompt_responses.lock().unwrap().push(response);
}
#[allow(dead_code)]
fn set_choice_response(&self, response: usize) {
self.choice_responses.lock().unwrap().push(response);
}
#[allow(dead_code)]
fn get_output(&self) -> Vec<String> {
self.output.lock().unwrap().clone()
}