refactor: deduplicate make_params test helper (#224) #227
@@ -294,13 +294,7 @@ impl ToolDispatcher {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn make_params(pairs: &[(&str, &str)]) -> HashMap<String, String> {
|
||||
pairs
|
||||
.iter()
|
||||
.map(|(k, v)| (k.to_string(), v.to_string()))
|
||||
.collect()
|
||||
}
|
||||
use crate::test_util::make_params;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_internal_executor_success() {
|
||||
|
||||
@@ -211,15 +211,9 @@ impl ToolExecutor for FsReadExecutor {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use crate::test_util::make_params;
|
||||
use tempfile::tempdir;
|
||||
|
||||
fn make_params(pairs: &[(&str, &str)]) -> HashMap<String, String> {
|
||||
pairs
|
||||
.iter()
|
||||
.map(|(k, v)| (k.to_string(), v.to_string()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_read_existing_file() {
|
||||
let dir = tempdir().unwrap();
|
||||
|
||||
@@ -117,15 +117,9 @@ impl ToolExecutor for FsWriteExecutor {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use crate::test_util::make_params;
|
||||
use tempfile::tempdir;
|
||||
|
||||
fn make_params(pairs: &[(&str, &str)]) -> HashMap<String, String> {
|
||||
pairs
|
||||
.iter()
|
||||
.map(|(k, v)| (k.to_string(), v.to_string()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_write_new_file() {
|
||||
let dir = tempdir().unwrap();
|
||||
|
||||
@@ -297,13 +297,7 @@ fn build_output(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn make_params(pairs: &[(&str, &str)]) -> HashMap<String, String> {
|
||||
pairs
|
||||
.iter()
|
||||
.map(|(k, v)| (k.to_string(), v.to_string()))
|
||||
.collect()
|
||||
}
|
||||
use crate::test_util::make_params;
|
||||
|
||||
// --- Package name validation ---
|
||||
|
||||
|
||||
@@ -394,13 +394,7 @@ fn build_output(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn make_params(pairs: &[(&str, &str)]) -> HashMap<String, String> {
|
||||
pairs
|
||||
.iter()
|
||||
.map(|(k, v)| (k.to_string(), v.to_string()))
|
||||
.collect()
|
||||
}
|
||||
use crate::test_util::make_params;
|
||||
|
||||
fn fast_executor() -> RunCodeExecutor {
|
||||
RunCodeExecutor::with_limits(
|
||||
|
||||
@@ -345,13 +345,7 @@ fn build_output(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn make_params(pairs: &[(&str, &str)]) -> HashMap<String, String> {
|
||||
pairs
|
||||
.iter()
|
||||
.map(|(k, v)| (k.to_string(), v.to_string()))
|
||||
.collect()
|
||||
}
|
||||
use crate::test_util::make_params;
|
||||
|
||||
fn fast_executor() -> RunShellExecutor {
|
||||
RunShellExecutor::with_limits(
|
||||
|
||||
@@ -9,3 +9,15 @@ pub mod loop_detector;
|
||||
pub mod manifest;
|
||||
pub mod result_tagger;
|
||||
pub mod service;
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod test_util {
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub fn make_params(pairs: &[(&str, &str)]) -> HashMap<String, String> {
|
||||
pairs
|
||||
.iter()
|
||||
.map(|(k, v)| (k.to_string(), v.to_string()))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user