on master help sign in
Add PowerShell syntax test
ec8072dDobe Peter
tests/syntax-tests/highlighted/PowerShell/test.ps1new file+25
@@ -0,0 +1,25 @@
1+# PowerShell script for testing syntax highlighting
2+
3+function Get-FutureTime {
4+ param (
5+ [Int32] $Minutes
6+ )
7+ 
8+ $time = Get-Date | % { $_.AddMinutes($Minutes) }
9+ "{0:d2}:{1:d2}:{2:d2}" -f @($time.hour, $time.minute, $time.second)
10+}
11+
12+if ($env:PATH -match '.*rust.*') {
13+ 'Path contains Rust'
14+ try {
15+ & "cargo" "--version"
16+ } catch {
17+ Write-Error "Failed to run cargo"
18+ }
19+} else {
20+ 'Path does not contain Rust'
21+}
22+
23+(5..30) | ? { $_ % (2 * 2 + 1) -eq 0 } | % {"In {0} minutes, the time will be {1}." -f $_, $( Get-FutureTime $_ )}
24+$later = Get-FutureTime -Minutes $( Get-Random -Minimum 60 -Maximum 120 )
25+"The time will be " + $later + " later."
tests/syntax-tests/source/PowerShell/test.ps1new file

Binary file not shown.