mirror of
https://github.com/nushell/nushell.git
synced 2025-05-30 22:57:07 +02:00
Revert back test deleted by accident.
This commit is contained in:
parent
174abf68bc
commit
c195c1d21d
@ -32,7 +32,7 @@ impl Str {
|
|||||||
Some(Action::ToInteger) => match input.trim().parse::<i64>() {
|
Some(Action::ToInteger) => match input.trim().parse::<i64>() {
|
||||||
Ok(v) => Value::int(v),
|
Ok(v) => Value::int(v),
|
||||||
Err(_) => Value::string(input),
|
Err(_) => Value::string(input),
|
||||||
}
|
},
|
||||||
None => Value::string(input.to_string()),
|
None => Value::string(input.to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,6 +290,22 @@ mod tests {
|
|||||||
assert_eq!(plugin.field, Some("package.description".to_string()));
|
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]
|
#[test]
|
||||||
fn str_downcases() {
|
fn str_downcases() {
|
||||||
let mut strutils = Str::new();
|
let mut strutils = Str::new();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user