@@ -23,19 +23,19 @@ $repoUrl = 'https://github.com/getsentry/github-workflows'
2323$currentVersion = (git - c ' versionsort.suffix=-' ls- remote -- tags -- sort= ' v:refname' $repoUrl `
2424 | Select-Object - Last 1 | Select-String - Pattern ' refs/tags/(.*)$' ).Matches.Groups[1 ].Value
2525
26- RunTest " properties-file" {
26+ RunTest ' properties-file' {
2727 $testFile = " $testDir /test.properties"
28- @ (" repo=$repoUrl " , " version = none" ) | Out-File $testFile
28+ @ (" repo=$repoUrl " , ' version = none' ) | Out-File $testFile
2929 UpdateDependency $testFile
3030 AssertEqual @ (" repo=$repoUrl " , " version = $currentVersion " ) (Get-Content $testFile )
3131}
3232
33- RunTest " version pattern match" {
33+ RunTest ' version pattern match' {
3434 $testFile = " $testDir /test.properties"
3535 $repo = ' https://github.com/getsentry/sentry-cli'
36- @ (" repo=$repo " , " version=0" ) | Out-File $testFile
36+ @ (" repo=$repo " , ' version=0' ) | Out-File $testFile
3737 UpdateDependency $testFile ' ^0\.'
38- AssertEqual @ (" repo=$repo " , " version=0.28.0" ) (Get-Content $testFile )
38+ AssertEqual @ (" repo=$repo " , ' version=0.28.0' ) (Get-Content $testFile )
3939}
4040
4141function _testOutput ([string []] $output )
@@ -48,27 +48,27 @@ function _testOutput([string[]] $output)
4848 AssertContains $output ' mainBranch=master'
4949}
5050
51- RunTest " writes output" {
51+ RunTest ' writes output' {
5252 $testFile = " $testDir /test.properties"
5353 $repo = ' https://github.com/getsentry/sentry-cli'
54- @ (" repo=$repo " , " version=0" ) | Out-File $testFile
54+ @ (" repo=$repo " , ' version=0' ) | Out-File $testFile
5555 $stdout = UpdateDependency $testFile ' ^0\.'
5656 _testOutput $stdout
5757}
5858
59- RunTest " writes to env:GITHUB_OUTPUT" {
59+ RunTest ' writes to env:GITHUB_OUTPUT' {
6060 $testFile = " $testDir /test.properties"
6161 $repo = ' https://github.com/getsentry/sentry-cli'
62- @ (" repo=$repo " , " version=0" ) | Out-File $testFile
62+ @ (" repo=$repo " , ' version=0' ) | Out-File $testFile
6363 $outFile = " $testDir /outfile"
6464 New-Item $outFile - ItemType File | Out-Null
6565 try
6666 {
6767 $env: GITHUB_OUTPUT = $outFile
6868 $stdout = UpdateDependency $testFile ' ^0\.'
69- Write-Host " Testing standard output"
69+ Write-Host ' Testing standard output'
7070 _testOutput $stdout
71- Write-Host " Testing env:GITHUB_OUTPUT"
71+ Write-Host ' Testing env:GITHUB_OUTPUT'
7272 _testOutput (Get-Content $outFile )
7373 }
7474 finally
@@ -80,15 +80,23 @@ RunTest "writes to env:GITHUB_OUTPUT" {
8080}
8181
8282# Note: without custom sorting, this would have yielded 'v1.7.31_gradle_plugin'
83- RunTest " version sorting must work properly" {
83+ RunTest ' version sorting must work properly' {
8484 $testFile = " $testDir /test.properties"
8585 $repo = ' https://github.com/getsentry/sentry-java'
86- @ (" repo=$repo " , " version=0" ) | Out-File $testFile
86+ @ (" repo=$repo " , ' version=0' ) | Out-File $testFile
8787 UpdateDependency $testFile ' ^v?[123].*$'
88- AssertEqual @ (" repo=$repo " , " version=3.2.1" ) (Get-Content $testFile )
88+ AssertEqual @ (" repo=$repo " , ' version=3.2.1' ) (Get-Content $testFile )
8989}
9090
91- RunTest " powershell-script" {
91+ RunTest ' will not update from a later release to an earlier release' {
92+ $testFile = " $testDir /test.properties"
93+ $repo = ' https://github.com/getsentry/sentry-java'
94+ @ (" repo=$repo " , ' version=999.0.0-beta.1' ) | Out-File $testFile
95+ UpdateDependency $testFile
96+ AssertEqual @ (" repo=$repo " , ' version=999.0.0-beta.1' ) (Get-Content $testFile )
97+ }
98+
99+ RunTest ' powershell-script' {
92100 $testFile = " $testDir /test.version"
93101 ' ' | Out-File $testFile
94102 $testScript = " $testDir /test.ps1"
@@ -109,7 +117,7 @@ switch ($action)
109117 AssertEqual $currentVersion (Get-Content $testFile )
110118}
111119
112- RunTest " bash-script" {
120+ RunTest ' bash-script' {
113121 $testFile = " $testDir /test.version"
114122 ' ' | Out-File $testFile
115123 $testScript = " $testDir /test.sh"
@@ -136,29 +144,29 @@ esac
136144'@ | Out-File $testScript
137145 UpdateDependency $testScript
138146 AssertEqual $currentVersion (Get-Content $testFile )
139- } - skipReason ($IsWindows ? " on Windows" : ' ' )
147+ } - skipReason ($IsWindows ? ' on Windows' : ' ' )
140148
141- RunTest " powershell-script fails in get-version" {
149+ RunTest ' powershell-script fails in get-version' {
142150 $testScript = " $testDir /test.ps1"
143151 @'
144152throw "Failure"
145153'@ | Out-File $testScript
146154
147- AssertFailsWith " get-version | output: Failure" { UpdateDependency $testScript }
155+ AssertFailsWith ' get-version | output: Failure' { UpdateDependency $testScript }
148156}
149157
150- RunTest " bash-script fails in get-version" {
158+ RunTest ' bash-script fails in get-version' {
151159 $testScript = " $testDir /test.sh"
152160 @'
153161#!/usr/bin/env bash
154162echo "Failure"
155163exit 1
156164'@ | Out-File $testScript
157165
158- AssertFailsWith " get-version | output: Failure" { UpdateDependency $testScript }
159- } - skipReason ($IsWindows ? " on Windows" : ' ' )
166+ AssertFailsWith ' get-version | output: Failure' { UpdateDependency $testScript }
167+ } - skipReason ($IsWindows ? ' on Windows' : ' ' )
160168
161- RunTest " powershell-script fails in get-repo" {
169+ RunTest ' powershell-script fails in get-repo' {
162170 $testScript = " $testDir /test.ps1"
163171 @'
164172param([string] $action, [string] $value)
@@ -168,10 +176,10 @@ if ($action -eq "get-repo")
168176}
169177'@ | Out-File $testScript
170178
171- AssertFailsWith " get-repo | output: Failure" { UpdateDependency $testScript }
179+ AssertFailsWith ' get-repo | output: Failure' { UpdateDependency $testScript }
172180}
173181
174- RunTest " bash-script fails in get-repo" {
182+ RunTest ' bash-script fails in get-repo' {
175183 $testScript = " $testDir /test.sh"
176184 @'
177185#!/usr/bin/env bash
@@ -186,10 +194,10 @@ get-repo)
186194esac
187195'@ | Out-File $testScript
188196
189- AssertFailsWith " get-repo | output: Failure" { UpdateDependency $testScript }
190- } - skipReason ($IsWindows ? " on Windows" : ' ' )
197+ AssertFailsWith ' get-repo | output: Failure' { UpdateDependency $testScript }
198+ } - skipReason ($IsWindows ? ' on Windows' : ' ' )
191199
192- RunTest " powershell-script fails in set-version" {
200+ RunTest ' powershell-script fails in set-version' {
193201 $testScript = " $testDir /test.ps1"
194202 @'
195203param([string] $action, [string] $value)
@@ -206,7 +214,7 @@ switch ($action)
206214 AssertFailsWith " set-version $currentVersion | output: Failure" { UpdateDependency $testScript }
207215}
208216
209- RunTest " bash-script fails in set-version" {
217+ RunTest ' bash-script fails in set-version' {
210218 $testScript = " $testDir /test.sh"
211219 @'
212220#!/usr/bin/env bash
228236'@ | Out-File $testScript
229237
230238 AssertFailsWith " set-version $currentVersion | output: Failure" { UpdateDependency $testScript }
231- } - skipReason ($IsWindows ? " on Windows" : ' ' )
239+ } - skipReason ($IsWindows ? ' on Windows' : ' ' )
0 commit comments