-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d3da08
commit 9601b79
Showing
4 changed files
with
83 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1 | ||
|
||
$expected = "$env:VCPKG_ROOT/ports/zlib`n$env:VCPKG_ROOT/ports/zlib/portfile.cmake`n-n" | ||
$expected = $expected.Replace('\', '/') | ||
|
||
Refresh-TestRoot | ||
|
||
$buildDir = (Get-Item $VcpkgExe).Directory | ||
$tempFilePath = "$TestingRoot/result.txt" | ||
|
||
$env:VCPKG_TEST_OUTPUT = $tempFilePath | ||
$editor = "$buildDir/test-editor" | ||
if ($IsWindows) { | ||
$editor += '.exe' | ||
} | ||
|
||
Write-Host "Using editor $editor" | ||
$env:EDITOR = $editor | ||
try { | ||
Run-Vcpkg edit zlib | ||
Throw-IfFailed | ||
|
||
$result = Get-Content -LiteralPath $tempFilePath -Raw | ||
} finally { | ||
Remove-Item env:VCPKG_TEST_OUTPUT | ||
Remove-Item env:EDITOR | ||
} | ||
|
||
$result = $result.Trim().Replace('\', '/') | ||
|
||
if ($result -ne $expected) { | ||
throw 'Did not edit the expected directory.' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#define _CRT_SECURE_NO_WARNINGS | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, const char* argv[]) | ||
{ | ||
const char* path; | ||
FILE* f; | ||
|
||
path = getenv("VCPKG_TEST_OUTPUT"); | ||
if (!path) | ||
{ | ||
puts("bad env var"); | ||
return 1; | ||
} | ||
|
||
f = fopen(path, "wb"); | ||
if (!f) | ||
{ | ||
puts("bad open"); | ||
return 1; | ||
} | ||
|
||
for (int idx = 1; idx < argc; ++idx) | ||
{ | ||
if (fputs(argv[idx], f) < 0) | ||
{ | ||
puts("bad write"); | ||
} | ||
|
||
if (fputs("\n", f) < 0) | ||
{ | ||
puts("bad write newline"); | ||
} | ||
} | ||
|
||
fclose(f); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters