Skip to content

Commit 6f8be12

Browse files
committed
fix arg tests
1 parent 6f997a3 commit 6f8be12

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

dsc/src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ pub fn get_input(input: &Option<String>, stdin: &Option<String>, path: &Option<S
425425
};
426426

427427
if value.trim().is_empty() {
428-
debug!("Provided input is empty");
429-
return String::new();
428+
error!("Provided input is empty");
429+
exit(EXIT_INVALID_INPUT);
430430
}
431431

432432
match parse_input_to_json(&value) {

dsc/tests/dsc_args.tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,22 +186,22 @@ resources:
186186
'' | dsc resource set -r Microsoft/OSInfo 2> $TestDrive/error.txt
187187
$err = Get-Content $testdrive/error.txt -Raw
188188
$err.Length | Should -Not -Be 0
189-
$LASTEXITCODE | Should -Be 1
189+
$LASTEXITCODE | Should -Be 4
190190
}
191191

192192
It 'input cannot be empty if neither stdin or path is provided' {
193193
dsc resource set -r Microsoft/OSInfo --input " " 2> $TestDrive/error.txt
194194
$err = Get-Content $testdrive/error.txt -Raw
195195
$err.Length | Should -Not -Be 0
196-
$LASTEXITCODE | Should -Be 1
196+
$LASTEXITCODE | Should -Be 4
197197
}
198198

199199
It 'path contents cannot be empty if neither stdin or input is provided' {
200200
Set-Content -Path $TestDrive/empty.yaml -Value " "
201201
dsc resource set -r Microsoft/OSInfo --path $TestDrive/empty.yaml 2> $TestDrive/error.txt
202202
$err = Get-Content $testdrive/error.txt -Raw
203203
$err.Length | Should -Not -Be 0
204-
$LASTEXITCODE | Should -Be 1
204+
$LASTEXITCODE | Should -Be 4
205205
}
206206

207207
It 'document cannot be empty if neither stdin or path is provided' {

0 commit comments

Comments
 (0)