Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Fix bug #9, use utf8 for .nuspec #419

Merged
merged 1 commit into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions Tests/PSGetPublishScript.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,45 @@ function SuiteCleanup {
RemoveItem $script:TempScriptsPath
}

Describe PowerShell.PSGet.PublishNonEnglishCharacterScriptTests -Tags 'BVT' {
BeforeAll {
SuiteSetup
}

AfterAll {
SuiteCleanup
}

BeforeEach {

}

AfterEach {
RemoveItem "$script:PSGalleryRepoPath\*"
RemoveItem $script:PublishScriptFilePath
RemoveItem "$script:TempScriptsPath\*.ps1"
RemoveItem "$script:TempScriptsLiteralPath\*"

}

It "PublishScriptRoundTripsNonAnsiCharacters" {
$description = "Remplace toutes les occurrences d'un modèle de caractère"
New-ScriptFileInfo -Path $script:PublishScriptFilePath `
-Version $script:PublishScriptVersion `
-Author Author@contoso.com `
-Description $description `
-Force

$sfi = Test-ScriptFileInfo -Path $script:PublishScriptFilePath
AssertEquals $description $sfi.Description

Publish-Script -Path $script:PublishScriptFilePath -NuGetApiKey $script:ApiKey
$psgetItemInfo = Find-Script $script:PublishScriptName

AssertEquals $description $psgetItemInfo.description
}

}
Describe PowerShell.PSGet.PublishScriptTests -Tags 'BVT','InnerLoop' {
BeforeAll {
SuiteSetup
Expand Down Expand Up @@ -123,6 +162,7 @@ Describe PowerShell.PSGet.PublishScriptTests -Tags 'BVT','InnerLoop' {




# Purpose: Validate Publish-Script cmdlet with versioned script dependencies
#
# Action:
Expand Down Expand Up @@ -1142,7 +1182,7 @@ Describe PowerShell.PSGet.PublishScriptTests -Tags 'BVT','InnerLoop' {

# Purpose: Validate that Publish-Module prompts to upgrade NuGet.exe if local NuGet.exe file is less than minimum required version
#
# Action: Publish-Script
# Action: Publish-Script
#
# Expected Result: Publish operation should fail, NuGet.exe should not upgrade to latest version
#
Expand Down Expand Up @@ -2128,4 +2168,4 @@ Describe PowerShell.PSGet.PublishScriptTests.P2 -Tags 'P2','OuterLoop' {
AssertEquals $res2.Name $ScriptName "Find-Script didn't find the exact script which has dependencies, $res2"
Assert ($res2.Dependencies.Name.Count -ge ($DepencyModuleNames.Count+$RequiredScripts.Count+1)) "Find-Script with -IncludeDependencies returned wrong results, $res4"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ $CsprojContent = @"
Microsoft.PowerShell.Management\Remove-Item $NuspecPath -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Confirm:$false -WhatIf:$false
}

Microsoft.PowerShell.Management\Set-Content -Value $nuspec -Path $NuspecPath -Force -Confirm:$false -WhatIf:$false
Microsoft.PowerShell.Management\Set-Content -Value $nuspec -Path $NuspecPath -Force -Confirm:$false -WhatIf:$false -Encoding UTF8

# Create .nupkg file
if($script:DotnetCommandPath) {
Expand Down Expand Up @@ -553,7 +553,7 @@ $CsprojContent = @"

if(Test-Path -Path $tempErrorFile -PathType Leaf) {
$errorMsg = Microsoft.PowerShell.Management\Get-Content -Path $tempErrorFile -Raw

if($errorMsg) {
Write-Verbose -Message $errorMsg
}
Expand Down