From 9bef07708d24f17c6f2b4c16ea46fd2a9a9e8a7e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 21 Aug 2024 13:51:25 -0500 Subject: [PATCH] test(complete): Simplify ArgValueCandidates test --- clap_complete/tests/testsuite/engine.rs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/clap_complete/tests/testsuite/engine.rs b/clap_complete/tests/testsuite/engine.rs index 425e0af3cbe..5fc363b0c62 100644 --- a/clap_complete/tests/testsuite/engine.rs +++ b/clap_complete/tests/testsuite/engine.rs @@ -4,7 +4,7 @@ use std::fs; use std::path::Path; use clap::{builder::PossibleValue, Command}; -use clap_complete::engine::{ArgValueCandidates, CompletionCandidate, ValueCandidates}; +use clap_complete::engine::{ArgValueCandidates, CompletionCandidate}; use snapbox::assert_data_eq; macro_rules! complete { @@ -577,23 +577,18 @@ d_dir/ #[test] fn suggest_custom_arg_value() { - #[derive(Debug)] - struct MyCustomCompleter {} - - impl ValueCandidates for MyCustomCompleter { - fn candidates(&self) -> Vec { - vec![ - CompletionCandidate::new("custom1"), - CompletionCandidate::new("custom2"), - CompletionCandidate::new("custom3"), - ] - } + fn custom_completer() -> Vec { + vec![ + CompletionCandidate::new("custom1"), + CompletionCandidate::new("custom2"), + CompletionCandidate::new("custom3"), + ] } let mut cmd = Command::new("dynamic").arg( clap::Arg::new("custom") .long("custom") - .add::(ArgValueCandidates::new(MyCustomCompleter {})), + .add(ArgValueCandidates::new(custom_completer)), ); assert_data_eq!(