Skip to content

Commit fd2c0c1

Browse files
committed
Fix test on array argument
1 parent a2b5fff commit fd2c0c1

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

dsc/tests/dsc_functions.tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ Describe 'tests for function expressions' {
345345
@{ expression = "[array('hello', 42)]"; expected = @('hello', 42) }
346346
@{ expression = "[array('a', 'b', 'c')]"; expected = @('a', 'b', 'c') }
347347
@{ expression = "[array(1, 2, 3)]"; expected = @(1, 2, 3) }
348-
@{ expression = "[array()]"; expected = @() }
349348
@{ expression = "[array('string', 123, createObject('key', 'value'))]"; expected = @('string', 123, [pscustomobject]@{ key = 'value' }) }
350349
@{ expression = "[array(createArray('a', 'b'), 'string')]"; expected = @(@('a', 'b'), 'string') }
351350
) {

dsc_lib/src/functions/array.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl Function for Array {
1717
name: "array".to_string(),
1818
description: t!("functions.array.description").to_string(),
1919
category: FunctionCategory::Array,
20-
min_args: 0,
20+
min_args: 1,
2121
max_args: usize::MAX,
2222
accepted_arg_ordered_types: vec![],
2323
remaining_arg_accepted_types: Some(vec![
@@ -81,10 +81,10 @@ mod tests {
8181
}
8282

8383
#[test]
84-
fn empty_array() {
84+
fn empty_array_not_allowed() {
8585
let mut parser = Statement::new().unwrap();
86-
let result = parser.parse_and_execute("[array()]", &Context::new()).unwrap();
87-
assert_eq!(result.to_string(), "[]");
86+
let result = parser.parse_and_execute("[array()]", &Context::new());
87+
assert!(result.is_err());
8888
}
8989

9090
#[test]

0 commit comments

Comments
 (0)