forked from exercism/csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-tests.ps1
More file actions
40 lines (34 loc) · 1.05 KB
/
generate-tests.ps1
File metadata and controls
40 lines (34 loc) · 1.05 KB
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
<#
.SYNOPSIS
Generate tests.
.DESCRIPTION
Generate tests based on the latest canonical data.
.PARAMETER Exercise
The slug of the exercise to be analyzed (optional).
.EXAMPLE
The example below will regenerate all tests
PS C:\> ./generate-tests.ps1
.EXAMPLE
The example below will regenerate the tests for the "acronym" exercise
PS C:\> ./generate-tests.ps1 acronym
#>
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Position = 0, Mandatory = $false)]
[string]$Exercise
)
. ./shared.ps1
function Update-TestFilesForTrack {
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Position = 0, Mandatory = $false)]
[string]$Exercise
)
$generatorsProject = "./generators"
$generatorsArgs = if ($Exercise) { @("--exercise", $Exercise) } else { @() }
if ($PSCmdlet.ShouldProcess($generatorsProject, "execute")) {
Write-Output "Updating tests"
Invoke-CallScriptExitOnError { dotnet run --project $generatorsProject $generatorsArgs }
}
}
Update-TestFilesForTrack $Exercise