Add optional commas for items in lists and tables (#2454)

This commit is contained in:
Jonathan Turner
2020-08-30 18:19:54 +12:00
committed by GitHub
parent 6f69ae8707
commit abc05ece21
2 changed files with 44 additions and 2 deletions

View File

@ -442,6 +442,30 @@ fn table_literals2() {
assert_eq!(actual.out, "33");
}
#[test]
fn list_with_commas() {
let actual = nu!(
cwd: ".",
r#"
echo [1, 2, 3] | math sum
"#
);
assert_eq!(actual.out, "6");
}
#[test]
fn table_with_commas() {
let actual = nu!(
cwd: ".",
r#"
echo [[name, age, height]; [JT, 42, 185] [Unknown, 99, 99]] | get age | math sum
"#
);
assert_eq!(actual.out, "141");
}
mod parse {
use nu_test_support::nu;