Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More tweaks #2316

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions bin/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ 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
Expand Down Expand Up @@ -88,33 +88,33 @@ 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}'"
}
}

function Invoke-Tests($Path, $IsCI) {
if ($IsCI) {
Get-ChildItem -Path $Path -Include "*.csproj" -Recurse | ForEach-Object {
& dotnet add $_.FullName package JunitXml.TestLogger -n -v 3.0.134
& dotnet add $_.FullName package JunitXml.TestLogger -v 4.1.0
}
& 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
Loading