-
-
Notifications
You must be signed in to change notification settings - Fork 360
/
Copy pathupdate-tests.ps1
52 lines (44 loc) · 1.25 KB
/
update-tests.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<#
.SYNOPSIS
Generate the tests for exercises
.DESCRIPTION
Generate the tests for exercises that have a template.
The tests are generated from canonical data.
.PARAMETER Exercise
The slug of the exercise to generate the tests for (optional).
.PARAMETER CreateNew
Create a new test generator file before generating the tests (switch).
.PARAMETER SyncProbSpecs
Sync the prob-specs repo used (switch).
.EXAMPLE
The example below will generate the tests for exercises with a template
PS C:\> ./test.ps1
.EXAMPLE
The example below will generate the tests for the specified exercise
PS C:\> ./test.ps1 acronym
#>
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Position = 0, Mandatory = $false)]
[string]$Exercise,
[Parameter()]
[switch]$New,
[Parameter()]
[switch]$SyncProbSpecs
)
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
function Run-Command($verb, $exercise = $null) {
if ($exercise) {
& dotnet run --project generators $verb --exercise $exercise
} else {
& dotnet run --project generators $verb
}
}
if ($SyncProbSpecs.IsPresent) {
Run-Command sync
}
if ($New.IsPresent) {
Run-Command new $Exercise
}
Run-Command update $Exercise