From c195c1d21db2931bfc1886776cd08ae09d575568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20N=2E=20Robalino?= Date: Wed, 31 Jul 2019 17:29:40 -0500 Subject: [PATCH] Revert back test deleted by accident. --- src/plugins/str.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/plugins/str.rs b/src/plugins/str.rs index 7e8ba6101e..7053bd5e1d 100644 --- a/src/plugins/str.rs +++ b/src/plugins/str.rs @@ -32,7 +32,7 @@ impl Str { Some(Action::ToInteger) => match input.trim().parse::() { Ok(v) => Value::int(v), Err(_) => Value::string(input), - } + }, None => Value::string(input.to_string()), } } @@ -290,6 +290,22 @@ mod tests { assert_eq!(plugin.field, Some("package.description".to_string())); } + #[test] + fn str_plugin_accepts_only_one_action() { + let mut plugin = Str::new(); + + assert!(plugin + .begin_filter( + CallStub::new() + .with_long_flag("upcase") + .with_long_flag("downcase") + .with_long_flag("to-int") + .create(), + ) + .is_err()); + assert_eq!(plugin.error, Some("can only apply one".to_string())); + } + #[test] fn str_downcases() { let mut strutils = Str::new();