1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-11-17 07:15:57 +00:00
Files
bat/tests/syntax-tests/highlighted/PowerShell/test.ps1
dag-h 08386daa3a Strip BOM from output in interactive mode (#1938)
* Strip BOM from output in interactive mode

* Strip BOM when not loop_through, add regression tests

* Update CHANGELOG.md

* Only strip BOM from beginning of first line

* Fix integration test on macOS that relied on color scheme

* Fix integration test on Windows that relied on detected terminal width

* Fix syntax test that was failing due to a previously wrong (now fixed) highlighting

Co-authored-by: David Peter <mail@david-peter.de>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2022-09-06 19:08:38 +02:00

5.6 KiB
Vendored

# PowerShell script for testing syntax highlighting
 
function Get-FutureTime {
param (
[Int32] $Minutes
)
 
$time = Get-Date | % { $_.AddMinutes($Minutes) }
"{0:d2}:{1:d2}:{2:d2}" -f @($time.hour, $time.minute, $time.second)
}
 
if ($env:PATH -match '.*rust.*') {
'Path contains Rust'
try {
& "cargo" "--version"
} catch {
Write-Error "Failed to run cargo"
}
} else {
'Path does not contain Rust'
}
 
(5..30) | ? { $_ % (2 * 2 + 1) -eq 0 } | % {"In {0} minutes, the time will be {1}." -f $_, $( Get-FutureTime $_ )}
$later = Get-FutureTime -Minutes $( Get-Random -Minimum 60 -Maximum 120 )
"The time will be " + $later + " later."