Move and "publish" EchoArgs for the tests

* Move EchoArgs from test/EchoArgs to test/tools/EchoArgs
* Use "dotnet publish" for building EchoArgs in build.psm1 so the test
  can call it directly
This commit is contained in:
Douglas Thrift committed 2016-09-13 13:37:42 -07:00
1 parent 7816516c24
commit 7e8070276f
5 files changed
+20 -16

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
bin/ bin/
obj/ obj/
run/
project.lock.json project.lock.json
*-tests.xml *-tests.xml
/debug/ /debug/
+16
View File
@@ -547,6 +547,20 @@ function Get-PesterTag {
$o $o
} }
function Publish-EchoArgs {
[CmdletBinding()]
param()
Find-Dotnet
Push-Location "$PSScriptRoot/test/tools/EchoArgs"
try {
dotnet publish --output run
} finally {
Pop-Location
}
}
function Start-PSPester { function Start-PSPester {
[CmdletBinding()] [CmdletBinding()]
param( param(
@@ -563,6 +577,8 @@ function Start-PSPester {
) )
Write-Verbose "Running pester tests at '$path' with tag '$($Tag -join ''', ''')' and ExcludeTag '$($ExcludeTag -join ''', ''')'" -Verbose Write-Verbose "Running pester tests at '$path' with tag '$($Tag -join ''', ''')' and ExcludeTag '$($ExcludeTag -join ''', ''')'" -Verbose
# Publish EchoArgs so it can be run by tests
Publish-EchoArgs
# All concatenated commands/arguments are suffixed with the delimiter (space) # All concatenated commands/arguments are suffixed with the delimiter (space)
$Command = "" $Command = ""
@@ -4,27 +4,18 @@ Describe "Native Command Arguments" -tags "CI" {
while ($powershellTestDir -notmatch 'test[\\/]powershell$') { while ($powershellTestDir -notmatch 'test[\\/]powershell$') {
$powershellTestDir = Split-Path $powershellTestDir $powershellTestDir = Split-Path $powershellTestDir
} }
$echoArgsDir = Join-Path (Split-Path $powershellTestDir) EchoArgs $echoArgs = Join-Path (Split-Path $powershellTestDir) tools/EchoArgs/run/echoargs
function Start-EchoArgs {
Push-Location $echoArgsDir
try {
dotnet run $args
} finally {
Pop-Location
}
}
It "Should handle quoted spaces correctly" { It "Should handle quoted spaces correctly" {
$a = 'a"b c"d' $a = 'a"b c"d'
Start-EchoArgs $a 'a"b c"d' a"b c"d >$testPath & $echoArgs $a 'a"b c"d' a"b c"d >$testPath
$testPath | Should Contain 'Arg 0 is <ab cd>' $testPath | Should Contain 'Arg 0 is <ab cd>'
$testPath | Should Contain 'Arg 1 is <ab cd>' $testPath | Should Contain 'Arg 1 is <ab cd>'
$testPath | Should Contain 'Arg 2 is <ab cd>' $testPath | Should Contain 'Arg 2 is <ab cd>'
} }
It "Should handle spaces between escaped quotes" { It "Should handle spaces between escaped quotes" {
Start-EchoArgs 'a\"b c\"d' "a\`"b c\`"d" >$testPath & $echoArgs 'a\"b c\"d' "a\`"b c\`"d" >$testPath
$testPath | Should Contain 'Arg 0 is <a"b c"d>' $testPath | Should Contain 'Arg 0 is <a"b c"d>'
$testPath | Should Contain 'Arg 1 is <a"b c"d>' $testPath | Should Contain 'Arg 1 is <a"b c"d>'
} }
@@ -19,10 +19,6 @@ namespace Pscx.Applications
{ {
Console.WriteLine("Arg {0} is <{1}>", i, args[i]); Console.WriteLine("Arg {0} is <{1}>", i, args[i]);
} }
/*Console.WriteLine("\nCommand line:");
Console.WriteLine(Environment.CommandLine);*/
Console.WriteLine();
} }
} }
} }
File renamed without changes.