nushell/crates/nu-command/tests/commands/while_.rs

12 lines
232 B
Rust
Raw Normal View History

2022-11-11 19:21:45 +01:00
use nu_test_support::nu;
#[test]
fn while_sum() {
let actual = nu!(
cwd: ".",
"mut total = 0; mut x = 0; while $x <= 10 { $total = $total + $x; $x = $x + 1 }; $total"
);
assert_eq!(actual.out, "55");
}