mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 06:35:56 +02:00
Add --to-float to str plugin (#1872)
This commit is contained in:
@ -9,7 +9,7 @@ fn can_only_apply_one() {
|
||||
"open caco3_plastics.csv | first 1 | str origin --downcase --upcase"
|
||||
);
|
||||
|
||||
assert!(actual.err.contains(r#"--capitalize|--downcase|--upcase|--to-int|--substring "start,end"|--replace|--find-replace [pattern replacement]|to-date-time|--trim]"#));
|
||||
assert!(actual.err.contains(r#"--capitalize|--downcase|--upcase|--to-int|--to-float|--substring "start,end"|--replace|--find-replace [pattern replacement]|to-date-time|--trim]"#));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -131,6 +131,21 @@ fn converts_to_int() {
|
||||
assert_eq!(actual.out, "1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn converts_to_float() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
echo "3.1, 0.0415"
|
||||
| split row ","
|
||||
| str --to-float
|
||||
| sum
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "3.1415");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replaces() {
|
||||
Playground::setup("plugin_str_test_5", |dirs, sandbox| {
|
||||
|
Reference in New Issue
Block a user