Skip to content

Commit

Permalink
More tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Oct 20, 2024
1 parent 86b40de commit 95ee3c8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions bin/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ function Enable-All-UnitTests($BuildDir) {
function Test-Refactoring-Projects($PracticeExercisesDir) {
Write-Output "Testing refactoring projects"
@("tree-building", "ledger", "markdown") | ForEach-Object {
Invoke-Tests -Path "$PracticeExercisesDir/$_"
Invoke-Tests -Path "${PracticeExercisesDir}/${_}"
}
}

function Set-ExampleImplementation {
[CmdletBinding(SupportsShouldProcess)]
param($ExercisesDir, $ReplaceFileName)

if ($PSCmdlet.ShouldProcess("Exercise $ReplaceFileName", "replace solution with example")) {
if ($PSCmdlet.ShouldProcess("Exercise ${ReplaceFileName}", "replace solution with example")) {
Get-ChildItem -Path $ExercisesDir -Include "*.csproj" -Recurse | ForEach-Object {
$stub = Join-Path -Path $_.Directory ($_.BaseName + ".cs")
$example = Join-Path -Path $_.Directory ".meta" $ReplaceFileName
$stub = "${_.Directory}/${_.BaseName}.cs"
$example = "${_.Directory}/.meta/${ReplaceFileName}"

Move-Item -Path $example -Destination $stub -Force
}
Expand All @@ -88,14 +88,14 @@ function Test-ExerciseImplementation($Exercise, $BuildDir, $ConceptExercisesDir,
if (-Not $Exercise) {
Invoke-Tests -Path $BuildDir -IsCI $IsCI
}
elseif (Test-Path "$ConceptExercisesDir/$Exercise") {
Invoke-Tests -Path "$ConceptExercisesDir/$Exercise" -IsCI $IsCI
elseif (Test-Path "${ConceptExercisesDir}/${Exercise}") {
Invoke-Tests -Path "${ConceptExercisesDir}/${Exercise}" -IsCI $IsCI
}
elseif (Test-Path "$PracticeExercisesDir/$Exercise") {
Invoke-Tests -Path "$PracticeExercisesDir/$Exercise" -IsCI $IsCI
elseif (Test-Path "${PracticeExercisesDir}/${Exercise}") {
Invoke-Tests -Path "${PracticeExercisesDir}/${Exercise}" -IsCI $IsCI
}
else {
throw "Could not find exercise '$Exercise'"
throw "Could not find exercise '${Exercise}'"
}
}

Expand All @@ -107,14 +107,14 @@ function Invoke-Tests($Path, $IsCI) {
& dotnet test $Path --logger "junit;LogFilePath=results/test.xml"
}
else {
& dotnet test "$Path"
& dotnet test $Path
}
}


$buildDir = Join-Path $PSScriptRoot "build"
$practiceExercisesDir = Join-Path $buildDir "practice"
$conceptExercisesDir = Join-Path $buildDir "concept"
$buildDir = "${PSScriptRoot}/build"
$practiceExercisesDir = "${buildDir}/practice"
$conceptExercisesDir = "${buildDir}/concept"
$sourceDir = Resolve-Path "exercises"
$isCi = [System.Convert]::ToBoolean($env:CI)

Expand Down

0 comments on commit 95ee3c8

Please sign in to comment.