-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathparse_examples.ps1
28 lines (25 loc) · 945 Bytes
/
parse_examples.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$ErrorCount = 0
$Config = "release"
$CargoConfig = if ($Config -eq "release") { "--release" } else { $null }
Write-Host "Building $Config. Please wait..." -ForegroundColor Cyan
cargo build $CargoConfig --example json_parser_auto
if ($LASTEXITCODE -ne 0) {
++$ErrorCount
}
Get-ChildItem ..\json\*.json | ForEach-Object {
Write-Host "Parsing example $($_.FullName)..." -ForegroundColor Cyan
cargo run $CargoConfig --example json_parser $_.FullName
if ($LASTEXITCODE -ne 0) {
++$ErrorCount
}
}
# --------------------------------------------------------------------------------------------------
# Final message
# --------------------------------------------------------------------------------------------------
if ($ErrorCount -gt 0) {
$Msg = "$ErrorCount error(s) occurred."
Write-Host -Object $Msg -ForegroundColor Red
}
else {
Write-Host "All examples successfully parsed." -ForegroundColor Green
}