Prevent powershell from adding a BOM to test input (#3595)
authorMartin Kroeker <martin@ruby.chemie.uni-freiburg.de>
Thu, 7 Apr 2022 12:24:19 +0000 (14:24 +0200)
committerGitHub <noreply@github.com>
Thu, 7 Apr 2022 12:24:19 +0000 (14:24 +0200)
* Prevent addition of a BOM to test input (which would distort the names of output files)

test/CMakeLists.txt

index 5214d9c..786fdd7 100644 (file)
@@ -28,13 +28,10 @@ endforeach()
 # $1 exec, $2 input, $3 output_result
 if(WIN32)
 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_helper.ps1
+"[Console]::InputEncoding = New-Object Text.UTF8Encoding $false\n"
 "if (Test-Path $args[2]) { Remove-Item -Force $args[2] } \n"
 "$ErrorActionPreference = \"Stop\"\n"
-"If ((Get-Content $args[1] | & file - | %{$_ -match \"BOM\"}) -contains $true) {\n"
-"echo 'Skipped due to wrong input encoding'\n"
-"exit 0\n"
-"}\n"
-"Get-Content $args[1] | & $args[0]\n"
+"Get-Content $args[1] | & $args[0]\n" 
 "If ((Get-Content $args[2] | %{$_ -match \"FATAL\"}) -contains $true) {\n"
 "echo Error\n"
 "exit 1\n"