@@ -23,19 +23,19 @@ $repoUrl = 'https://github.com/getsentry/github-workflows'
23
23
$currentVersion = (git - c ' versionsort.suffix=-' ls- remote -- tags -- sort= ' v:refname' $repoUrl `
24
24
| Select-Object - Last 1 | Select-String - Pattern ' refs/tags/(.*)$' ).Matches.Groups[1 ].Value
25
25
26
- RunTest " properties-file" {
26
+ RunTest ' properties-file' {
27
27
$testFile = " $testDir /test.properties"
28
- @ (" repo=$repoUrl " , " version = none" ) | Out-File $testFile
28
+ @ (" repo=$repoUrl " , ' version = none' ) | Out-File $testFile
29
29
UpdateDependency $testFile
30
30
AssertEqual @ (" repo=$repoUrl " , " version = $currentVersion " ) (Get-Content $testFile )
31
31
}
32
32
33
- RunTest " version pattern match" {
33
+ RunTest ' version pattern match' {
34
34
$testFile = " $testDir /test.properties"
35
35
$repo = ' https://github.com/getsentry/sentry-cli'
36
- @ (" repo=$repo " , " version=0" ) | Out-File $testFile
36
+ @ (" repo=$repo " , ' version=0' ) | Out-File $testFile
37
37
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 )
39
39
}
40
40
41
41
function _testOutput ([string []] $output )
@@ -48,27 +48,27 @@ function _testOutput([string[]] $output)
48
48
AssertContains $output ' mainBranch=master'
49
49
}
50
50
51
- RunTest " writes output" {
51
+ RunTest ' writes output' {
52
52
$testFile = " $testDir /test.properties"
53
53
$repo = ' https://github.com/getsentry/sentry-cli'
54
- @ (" repo=$repo " , " version=0" ) | Out-File $testFile
54
+ @ (" repo=$repo " , ' version=0' ) | Out-File $testFile
55
55
$stdout = UpdateDependency $testFile ' ^0\.'
56
56
_testOutput $stdout
57
57
}
58
58
59
- RunTest " writes to env:GITHUB_OUTPUT" {
59
+ RunTest ' writes to env:GITHUB_OUTPUT' {
60
60
$testFile = " $testDir /test.properties"
61
61
$repo = ' https://github.com/getsentry/sentry-cli'
62
- @ (" repo=$repo " , " version=0" ) | Out-File $testFile
62
+ @ (" repo=$repo " , ' version=0' ) | Out-File $testFile
63
63
$outFile = " $testDir /outfile"
64
64
New-Item $outFile - ItemType File | Out-Null
65
65
try
66
66
{
67
67
$env: GITHUB_OUTPUT = $outFile
68
68
$stdout = UpdateDependency $testFile ' ^0\.'
69
- Write-Host " Testing standard output"
69
+ Write-Host ' Testing standard output'
70
70
_testOutput $stdout
71
- Write-Host " Testing env:GITHUB_OUTPUT"
71
+ Write-Host ' Testing env:GITHUB_OUTPUT'
72
72
_testOutput (Get-Content $outFile )
73
73
}
74
74
finally
@@ -80,15 +80,23 @@ RunTest "writes to env:GITHUB_OUTPUT" {
80
80
}
81
81
82
82
# 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' {
84
84
$testFile = " $testDir /test.properties"
85
85
$repo = ' https://github.com/getsentry/sentry-java'
86
- @ (" repo=$repo " , " version=0" ) | Out-File $testFile
86
+ @ (" repo=$repo " , ' version=0' ) | Out-File $testFile
87
87
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 )
89
89
}
90
90
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' {
92
100
$testFile = " $testDir /test.version"
93
101
' ' | Out-File $testFile
94
102
$testScript = " $testDir /test.ps1"
@@ -109,7 +117,7 @@ switch ($action)
109
117
AssertEqual $currentVersion (Get-Content $testFile )
110
118
}
111
119
112
- RunTest " bash-script" {
120
+ RunTest ' bash-script' {
113
121
$testFile = " $testDir /test.version"
114
122
' ' | Out-File $testFile
115
123
$testScript = " $testDir /test.sh"
@@ -136,29 +144,29 @@ esac
136
144
'@ | Out-File $testScript
137
145
UpdateDependency $testScript
138
146
AssertEqual $currentVersion (Get-Content $testFile )
139
- } - skipReason ($IsWindows ? " on Windows" : ' ' )
147
+ } - skipReason ($IsWindows ? ' on Windows' : ' ' )
140
148
141
- RunTest " powershell-script fails in get-version" {
149
+ RunTest ' powershell-script fails in get-version' {
142
150
$testScript = " $testDir /test.ps1"
143
151
@'
144
152
throw "Failure"
145
153
'@ | Out-File $testScript
146
154
147
- AssertFailsWith " get-version | output: Failure" { UpdateDependency $testScript }
155
+ AssertFailsWith ' get-version | output: Failure' { UpdateDependency $testScript }
148
156
}
149
157
150
- RunTest " bash-script fails in get-version" {
158
+ RunTest ' bash-script fails in get-version' {
151
159
$testScript = " $testDir /test.sh"
152
160
@'
153
161
#!/usr/bin/env bash
154
162
echo "Failure"
155
163
exit 1
156
164
'@ | Out-File $testScript
157
165
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' : ' ' )
160
168
161
- RunTest " powershell-script fails in get-repo" {
169
+ RunTest ' powershell-script fails in get-repo' {
162
170
$testScript = " $testDir /test.ps1"
163
171
@'
164
172
param([string] $action, [string] $value)
@@ -168,10 +176,10 @@ if ($action -eq "get-repo")
168
176
}
169
177
'@ | Out-File $testScript
170
178
171
- AssertFailsWith " get-repo | output: Failure" { UpdateDependency $testScript }
179
+ AssertFailsWith ' get-repo | output: Failure' { UpdateDependency $testScript }
172
180
}
173
181
174
- RunTest " bash-script fails in get-repo" {
182
+ RunTest ' bash-script fails in get-repo' {
175
183
$testScript = " $testDir /test.sh"
176
184
@'
177
185
#!/usr/bin/env bash
@@ -186,10 +194,10 @@ get-repo)
186
194
esac
187
195
'@ | Out-File $testScript
188
196
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' : ' ' )
191
199
192
- RunTest " powershell-script fails in set-version" {
200
+ RunTest ' powershell-script fails in set-version' {
193
201
$testScript = " $testDir /test.ps1"
194
202
@'
195
203
param([string] $action, [string] $value)
@@ -206,7 +214,7 @@ switch ($action)
206
214
AssertFailsWith " set-version $currentVersion | output: Failure" { UpdateDependency $testScript }
207
215
}
208
216
209
- RunTest " bash-script fails in set-version" {
217
+ RunTest ' bash-script fails in set-version' {
210
218
$testScript = " $testDir /test.sh"
211
219
@'
212
220
#!/usr/bin/env bash
228
236
'@ | Out-File $testScript
229
237
230
238
AssertFailsWith " set-version $currentVersion | output: Failure" { UpdateDependency $testScript }
231
- } - skipReason ($IsWindows ? " on Windows" : ' ' )
239
+ } - skipReason ($IsWindows ? ' on Windows' : ' ' )
0 commit comments