full_path stringlengths 31 232 | filename stringlengths 4 167 | content stringlengths 0 48.3M |
|---|---|---|
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/TestDrive.Tests.ps1 | TestDrive.Tests.ps1 | Set-StrictMode -Version Latest
$tempPath = (Get-Item $env:temp).FullName
Describe "Setup" {
It "returns a location that is in a temp area" {
$testDrivePath = (Get-Item $TestDrive).FullName
$testDrivePath -like "$tempPath*" | Should Be $true
}
It "creates a drive location called ... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/InModuleScope.Tests.ps1 | InModuleScope.Tests.ps1 | Set-StrictMode -Version Latest
Describe "Module scope separation" {
Context "When users define variables with the same name as Pester parameters" {
$test = "This is a test."
It "does not hide user variables" {
$test | Should Be 'This is a test.'
}
}
It "Does... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/In.Tests.ps1 | In.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "the In statement" {
Setup -Dir "test_path"
It "executes a command in that directory" {
In "$TestDrive" -Execute { "" | Out-File "test_file" }
"$TestDrive\test_file" | Should Exist
}
... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/SetupTeardown.ps1 | SetupTeardown.ps1 | function BeforeEach
{
<#
.SYNOPSIS
Defines a series of steps to perform at the beginning of every It block within
the current Context or Describe block.
.DESCRIPTION
BeforeEach, AfterEach, BeforeAll, and AfterAll are unique in that they apply
to the entire Context or Describe block, regardless... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/GlobalMock-B.Tests.ps1 | GlobalMock-B.Tests.ps1 | # This test depends on some state set up in GlobalMock-A.Tests.ps1. The behavior we're verifying
# is that global functions that have been mocked are still properly set up even after the test
# script exits its scope.
$functionName = '01c1a57716fe4005ac1a7bf216f38ad0'
try
{
Describe 'Mocking Global Funct... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Coverage.ps1 | Coverage.ps1 | if ($PSVersionTable.PSVersion.Major -le 2)
{
function Exit-CoverageAnalysis { }
function Get-CoverageReport { }
function Show-CoverageReport { }
function Enter-CoverageAnalysis {
param ( $CodeCoverage )
if ($CodeCoverage) { & $SafeCommands['Write-Error'] 'Code coverage analysis ... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/New-Fixture.Tests.ps1 | New-Fixture.Tests.ps1 | Set-StrictMode -Version Latest
Describe "New-Fixture" {
It "Name parameter is mandatory:" {
(get-command New-Fixture ).Parameters.Name.ParameterSets.__AllParameterSets.IsMandatory | Should Be $true
}
Context "Only Name parameter is specified:" {
It "Creates fixture in current direc... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Describe.Tests.ps1 | Describe.Tests.ps1 | Set-StrictMode -Version Latest
Describe 'Testing Describe' {
It 'Has a non-mandatory fixture parameter which throws the proper error message if missing' {
$command = Get-Command Describe -Module Pester
$command | Should Not Be $null
$parameter = $command.Parameters['Fixture']
... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Context.Tests.ps1 | Context.Tests.ps1 | Set-StrictMode -Version Latest
Describe 'Testing Context' {
It 'Has a non-mandatory fixture parameter which throws the proper error message if missing' {
$command = Get-Command Context -Module Pester
$command | Should Not Be $null
$parameter = $command.Parameters['Fixture']
... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/TestResults.Tests.ps1 | TestResults.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "Write nunit test results (Legacy)" {
Setup -Dir "Results"
It "should write a successful test result" {
#create state
$TestResults = New-PesterState -Path TestDrive:\
$testResults.EnterDescr... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/PesterState.ps1 | PesterState.ps1 | function New-PesterState
{
param (
[String[]]$TagFilter,
[String[]]$ExcludeTagFilter,
[String[]]$TestNameFilter,
[System.Management.Automation.SessionState]$SessionState,
[Switch]$Strict,
[Switch]$Quiet,
[object]$PesterOption
)
if ($null -... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/PesterState.Tests.ps1 | PesterState.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "New-PesterState" {
Context "TestNameFilter parameter is set" {
$p = new-pesterstate -TestNameFilter "filter"
it "sets the TestNameFilter property" {
$p.TestNameFilter | should be "filter"
... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Context.ps1 | Context.ps1 | function Context {
<#
.SYNOPSIS
Provides logical grouping of It blocks within a single Describe block. Any Mocks defined
inside a Context are removed at the end of the Context scope, as are any files or folders
added to the TestDrive during the Context block's execution. Any BeforeEach or AfterEach
blocks defined... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Mock.Tests.ps1 | Mock.Tests.ps1 | Set-StrictMode -Version Latest
function FunctionUnderTest
{
[CmdletBinding()]
param (
[Parameter(Mandatory=$false)]
[string]
$param1
)
return "I am a real world test"
}
function FunctionUnderTestWithoutParams([string]$param1) {
return "I am a real world test... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Coverage.Tests.ps1 | Coverage.Tests.ps1 | if ($PSVersionTable.PSVersion.Major -le 2) { return }
InModuleScope Pester {
Describe 'Code Coverage Analysis' {
$root = (Get-PSDrive TestDrive).Root
$null = New-Item -Path $root\TestScript.ps1 -ItemType File -ErrorAction SilentlyContinue
Set-Content -Path $root\TestScript.ps1 -Va... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/It.ps1 | It.ps1 | function It {
<#
.SYNOPSIS
Validates the results of a test inside of a Describe block.
.DESCRIPTION
The It command is intended to be used inside of a Describe or Context Block.
If you are familiar with the AAA pattern (Arrange-Act-Assert), the body of
the It block is the appropriate location for an assert. The... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/In.ps1 | In.ps1 | function In {
<#
.SYNOPSIS
A convenience function that executes a script from a specified path.
.DESCRIPTION
Before the script block passed to the execute parameter is invoked,
the current location is set to the path specified. Once the script
block has been executed, the location will be reset to the location... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/SetupTeardown.Tests.ps1 | SetupTeardown.Tests.ps1 | Describe 'Describe-Scoped Test Case setup' {
BeforeEach {
$testVariable = 'From BeforeEach'
}
$testVariable = 'Set in Describe'
It 'Assigns the correct value in first test' {
$testVariable | Should Be 'From BeforeEach'
$testVariable = 'Set in It'
}
It 'Assi... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/GlobalMock-A.Tests.ps1 | GlobalMock-A.Tests.ps1 | # This script exists to create and mock a global function, then exit. The actual behavior
# that we need to test is covered in GlobalMock-B.Tests.ps1, where we make sure that the
# global function was properly restored in its scope.
$functionName = '01c1a57716fe4005ac1a7bf216f38ad0'
if (Test-Path Function:\$fu... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/InModuleScope.ps1 | InModuleScope.ps1 | function InModuleScope
{
<#
.SYNOPSIS
Allows you to execute parts of a test script within the
scope of a PowerShell script module.
.DESCRIPTION
By injecting some test code into the scope of a PowerShell
script module, you can use non-exported functions, aliases
and variables inside that module, ... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Mock.ps1 | Mock.ps1 | function Mock {
<#
.SYNOPSIS
Mocks the behavior of an existing command with an alternate
implementation.
.DESCRIPTION
This creates new behavior for any existing command within the scope of a
Describe or Context block. The function allows you to specify a script block
that will become the command's new behav... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Describe.ps1 | Describe.ps1 | function Describe {
<#
.SYNOPSIS
Creates a logical group of tests. All Mocks and TestDrive contents
defined within a Describe block are scoped to that Describe; they
will no longer be present when the Describe block exits. A Describe
block may contain any number of Context and It blocks.
.PARAMETER Name
The... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Match.ps1 | Match.ps1 |
function PesterMatch($value, $expectedMatch) {
return ($value -match $expectedMatch)
}
function PesterMatchFailureMessage($value, $expectedMatch) {
return "Expected: {$value} to match the expression {$expectedMatch}"
}
function NotPesterMatchFailureMessage($value, $expectedMatch) {
return "Expe... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/MatchExactly.Tests.ps1 | MatchExactly.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "MatchExactly" {
It "returns true for things that match exactly" {
PesterMatchExactly "foobar" "ob" | Should Be $true
}
It "returns false for things that do not match exactly" {
PesterMatchExact... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Set-TestInconclusive.ps1 | Set-TestInconclusive.ps1 | function New-InconclusiveErrorRecord ([string] $Message, [string] $File, [string] $Line, [string] $LineText) {
$exception = New-Object Exception $Message
$errorID = 'PesterTestInconclusive'
$errorCategory = [Management.Automation.ErrorCategory]::InvalidResult
# we use ErrorRecord.TargetObject to pas... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/PesterThrow.Tests.ps1 | PesterThrow.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterThrow" {
It "returns true if the statement throws an exception" {
Test-PositiveAssertion (PesterThrow { throw })
}
It "returns false if the statement does not throw an exception" {
Test-N... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeNullOrEmpty.ps1 | BeNullOrEmpty.ps1 |
function PesterBeNullOrEmpty($value) {
if ($null -eq $value) {
return $true
}
if ([String] -eq $value.GetType()) {
return [String]::IsNullOrEmpty($value)
}
if ($null -ne $value.PSObject.Properties['Count'] -and
$null -ne $value.Count) {
return $value.Count ... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeLikeExactly.ps1 | BeLikeExactly.ps1 |
function PesterBeLikeExactly($value, $expectedMatch) {
return ($value -clike $expectedMatch)
}
function PesterBeLikeFailureMessage($value, $expectedMatch) {
return "Expected: {$value} to be exactly like the wildcard {$expectedMatch}"
}
function NotPesterBeLikeFailureMessage($value, $expectedMatch) {... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Should.Tests.ps1 | Should.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "Parse-ShouldArgs" {
It "sanitizes assertions functions" {
$parsedArgs = Parse-ShouldArgs TestFunction
$parsedArgs.AssertionMethod | Should Be PesterTestFunction
}
It "works with strict mode whe... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeLike.ps1 | BeLike.ps1 |
function PesterBeLike($value, $expectedMatch) {
return ($value -like $expectedMatch)
}
function PesterBeLikeFailureMessage($value, $expectedMatch) {
return "Expected: {$value} to be like the wildcard {$expectedMatch}"
}
function NotPesterBeLikeFailureMessage($value, $expectedMatch) {
return "Ex... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Exist.ps1 | Exist.ps1 |
function PesterExist($value) {
& $SafeCommands['Test-Path'] $value
}
function PesterExistFailureMessage($value) {
return "Expected: {$value} to exist"
}
function NotPesterExistFailureMessage($value) {
return "Expected: ${value} to not exist, but it was found"
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeLikeExactly.Tests.ps1 | BeLikeExactly.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "BeLike" {
It "returns true for things that are like wildcard" {
PesterBeLikeExactly "FOOBAR" "*OB*" | Should Be $true
}
It "returns false for things that do not match" {
PesterBeLikeExactly "fo... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/PesterThrow.ps1 | PesterThrow.ps1 |
$ActualExceptionMessage = ""
$ActualExceptionWasThrown = $false
# because this is a script block, the user will have to
# wrap the code they want to assert on in { }
function PesterThrow([scriptblock] $script, $expectedErrorMessage) {
$Script:ActualExceptionMessage = ""
$Script:ActualExceptionWasThrow... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeLessThan.Tests.ps1 | BeLessThan.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBeLessThan" {
It "passes if value Less than expected" {
Test-PositiveAssertion (PesterBeLessThan 1 2)
1 | Should BeLessThan 2
}
It "fails if values equal" {
Test-NegativeAssert... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeGreaterThan.ps1 | BeGreaterThan.ps1 | function PesterBeGreaterThan($value, $expected)
{
return [bool]($value -gt $expected)
}
function PesterBeGreaterThanFailureMessage($value,$expected)
{
return "Expected {$value} to be greater than {$expected}"
}
function NotPesterBeGreaterThanFailureMessage($value,$expected)
{
return "Expected ... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeNullOrEmpty.Tests.ps1 | BeNullOrEmpty.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBeNullOrEmpty" {
It "should return true if null" {
Test-PositiveAssertion (PesterBeNullOrEmpty $null)
}
It "should return true if empty string" {
Test-PositiveAssertion (PesterBeNullOrEmp... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/MatchExactly.ps1 | MatchExactly.ps1 |
function PesterMatchExactly($value, $expectedMatch) {
return ($value -cmatch $expectedMatch)
}
function PesterMatchExactlyFailureMessage($value, $expectedMatch) {
return "Expected: {$value} to exactly match the expression {$expectedMatch}"
}
function NotPesterMatchExactlyFailureMessage($value, $expe... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Match.Tests.ps1 | Match.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "Match" {
It "returns true for things that match" {
PesterMatch "foobar" "ob" | Should Be $true
}
It "returns false for things that do not match" {
PesterMatch "foobar" "slime" | Should Be $fals... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeGreaterThan.Tests.ps1 | BeGreaterThan.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBeGreaterThan" {
It "passes if value greater than expected" {
Test-PositiveAssertion (PesterBeGreaterThan 2 1)
2 | Should BeGreaterThan 1
}
It "fails if values equal" {
Test-Ne... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeLike.Tests.ps1 | BeLike.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "BeLike" {
It "returns true for things that are like wildcard" {
PesterBeLike "foobar" "*ob*" | Should Be $true
}
It "returns false for things that do not match" {
PesterBeLike "foobar" "oob" | ... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Be.ps1 | Be.ps1 | #Be
function PesterBe($value, $expected) {
return ($expected -eq $value)
}
function PesterBeFailureMessage($value, $expected) {
if (-not (($expected -is [string]) -and ($value -is [string])))
{
return "Expected: {$expected}`nBut was: {$value}"
}
<#joining the output strings to a ... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Contain.Tests.ps1 | Contain.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterContain" {
Context "when testing file contents" {
Setup -File "test.txt" "this is line 1`nrush is awesome`nAnd this is Unicode: ☺"
It "returns true if the file contains the specified content" {
... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Test-Assertion.ps1 | Test-Assertion.ps1 |
function Test-PositiveAssertion($result) {
if (-not $result) {
throw "Expecting expression to pass, but it failed"
}
}
function Test-NegativeAssertion($result) {
if ($result) {
throw "Expecting expression to pass, but it failed"
}
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeOfType.Tests.ps1 | BeOfType.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBeOfType" {
It "passes if value is of the expected type" {
Test-PositiveAssertion (PesterBeOfType 1 ([int]))
Test-PositiveAssertion (PesterBeOfType 1 "Int")
1 | Should BeOfType Int
... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Contain.ps1 | Contain.ps1 |
function PesterContain($file, $contentExpecation) {
return ((& $SafeCommands['Get-Content'] -Encoding UTF8 $file) -match $contentExpecation)
}
function PesterContainFailureMessage($file, $contentExpecation) {
return "Expected: file ${file} to contain {$contentExpecation}"
}
function NotPesterContain... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Should.ps1 | Should.ps1 | function Parse-ShouldArgs([array] $shouldArgs) {
if ($null -eq $shouldArgs) { $shouldArgs = @() }
$parsedArgs = @{
PositiveAssertion = $true
ExpectedValue = $null
}
$assertionMethodIndex = 0
$expectedValueIndex = 1
if ($shouldArgs.Count -gt 0 -and $shouldArgs[0].T... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeOfType.ps1 | BeOfType.ps1 |
function PesterBeOfType($value, $expectedType) {
trap [System.Management.Automation.PSInvalidCastException] { return $false }
if($expectedType -is [string] -and !($expectedType -as [Type])) {
$expectedType = $expectedType -replace '^\[(.*)\]$','$1'
}
return [bool]($value -is $expectedType... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Exist.Tests.ps1 | Exist.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterExist" {
It "returns true for paths that exist" {
Test-PositiveAssertion (PesterExist $TestDrive)
}
It "returns false for paths do not exist" {
Test-NegativeAssertion (PesterExist "$TestD... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/BeLessThan.ps1 | BeLessThan.ps1 | function PesterBeLessThan($value, $expected)
{
return [bool]($value -lt $expected)
}
function PesterBeLessThanFailureMessage($value,$expected)
{
return "Expected {$value} to be less than {$expected}"
}
function NotPesterBeLessThanFailureMessage($value,$expected)
{
return "Expected {$value} to ... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/Be.Tests.ps1 | Be.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterBe" {
It "returns true if the 2 arguments are equal" {
Test-PositiveAssertion (PesterBe 1 1)
}
It "returns true if the 2 arguments are equal and have different case" {
Test-PositiveAssertio... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/ContainExactly.Tests.ps1 | ContainExactly.Tests.ps1 | Set-StrictMode -Version Latest
InModuleScope Pester {
Describe "PesterContainExactly" {
Context "when testing file contents" {
Setup -File "test.txt" "this is line 1`nPester is awesome`nAnd this is Unicode: ☺"
It "returns true if the file contains the specified content exactly... |
PowerShellCorpus/Github/csharris_psake-pester-test/Pester/Functions/Assertions/ContainExactly.ps1 | ContainExactly.ps1 | function PesterContainExactly($file, $contentExpecation) {
return ((& $SafeCommands['Get-Content'] -Encoding UTF8 $file) -cmatch $contentExpecation)
}
function PesterContainExactlyFailureMessage($file, $contentExpecation) {
return "Expected: file ${file} to contain exactly {$contentExpecation}"
}
func... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/NuGetPackageBuilder.ps1 | NuGetPackageBuilder.ps1 | $scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
$manifestPath = Join-Path $dir psake.psd1
try
{
$manifest = Test-ModuleManifest -Path $manifestPath -WarningAction SilentlyContinue -ErrorAction Stop
$version = $manifest.Version.ToString()
}
catch
{
throw
}
"Version nu... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/psake-config.ps1 | psake-config.ps1 | <#
-------------------------------------------------------------------
Defaults
-------------------------------------------------------------------
$config.buildFileName="default.ps1"
$config.framework = "4.0"
$config.taskNameFormat="Executing {0}"
$config.verboseError=$false
$config.coloredOutput = $true
$config.modul... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/psake-buildTester.ps1 | psake-buildTester.ps1 | function Main()
{
write-host "Running psake build tests" -ForeGroundColor GREEN
remove-module psake -ea SilentlyContinue
import-module .\psake.psm1
$psake.run_by_psake_build_tester = $true
$results = runBuilds
remove-module psake
""
$results | Sort 'Name' | % { if ($_.Result -eq "Passed") { write-hos... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/psake.ps1 | psake.ps1 | # Helper script for those who want to run psake without importing the module.
# Example run from PowerShell:
# .\psake.ps1 "default.ps1" "BuildHelloWord" "4.0"
# Must match parameter definitions for psake.psm1/invoke-psake
# otherwise named parameter binding fails
param(
[Parameter(Position=0,Mandatory=0)... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/nuget/tools/init.ps1 | init.ps1 | param($installPath, $toolsPath, $package)
$psakeModule = Join-Path $toolsPath psake.psm1
import-module $psakeModule
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/nuget/tools/chocolateyInstall.ps1 | chocolateyInstall.ps1 | $nugetPath = $env:ChocolateyInstall
$nugetExePath = Join-Path $nuGetPath 'bin'
$packageBatchFileName = Join-Path $nugetExePath "psake.bat"
$psakeDir = (Split-Path -parent $MyInvocation.MyCommand.Definition)
#$path = ($psakeDir | Split-Path | Join-Path -ChildPath 'psake.cmd')
$path = Join-Path $psakeDir 'psake.cmd'
W... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/tabexpansion/PsakeTabExpansion.ps1 | PsakeTabExpansion.ps1 | $global:psakeSwitches = @('-docs', '-task', '-properties', '-parameters')
function script:psakeSwitches($filter) {
$psakeSwitches | where { $_ -like "$filter*" }
}
function script:psakeDocs($filter, $file) {
if ($file -eq $null -or $file -eq '') { $file = 'default.ps1' }
psake $file -docs | out-string... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/docs_should_pass.ps1 | docs_should_pass.ps1 |
Task default -depends CheckDocs
Task CheckDocs {
$doc = Invoke-psake .\nested\docs.ps1 -docs -nologo | Out-String
$expectedDoc = @"
Name Alias Depends On Default Description
---- ----- ---------- ------- ----------- ... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/simple_properties_and_tasks_should_pass.ps1 | simple_properties_and_tasks_should_pass.ps1 | properties {
$testMessage = 'Executed Test!'
$compileMessage = 'Executed Compile!'
$cleanMessage = 'Executed Clean!'
}
task default -depends Test
task Test -depends Compile, Clean {
$testMessage
}
task Compile -depends Clean {
$compileMessage
}
task Clean {
$cleanMessage
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_initialization_block_should_pass.ps1 | using_initialization_block_should_pass.ps1 | properties {
$container = @{}
$container.foo = "foo"
$container.bar = $null
$foo = 1
$bar = 1
}
task default -depends TestInit
task TestInit {
# values are:
# 1: original
# 2: overide
# 3: new
Assert ($container.foo -eq "foo") "$container.foo should be foo"
Assert ($container.bar ... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_precondition_should_pass.ps1 | using_precondition_should_pass.ps1 | task default -depends A,B,C
task A {
"TaskA"
}
task B -precondition { return $false } {
"TaskB"
}
task C -precondition { return $true } {
"TaskC"
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/duplicate_alias_should_fail.ps1 | duplicate_alias_should_fail.ps1 | task default
task A -alias a {}
task B -alias b {}
task C -alias a {} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_postcondition_should_pass.ps1 | using_postcondition_should_pass.ps1 | task default -depends A,B,C
task A {
"TaskA"
}
task B -postcondition { return $true } {
"TaskB"
}
task C {
"TaskC"
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/calling_invoke-task_should_pass.ps1 | calling_invoke-task_should_pass.ps1 | task default -depends A,B
task A {
}
task B {
"inside task B before calling task C"
invoke-task C
"inside task B after calling task C"
}
task C {
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/executing_module_function_that_depends_on_another_module_should_pass.ps1 | executing_module_function_that_depends_on_another_module_should_pass.ps1 | task default -depends test
task test {
invoke-psake modules\default.ps1
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/failing_postcondition_should_fail.ps1 | failing_postcondition_should_fail.ps1 | task default -depends A,B,C
task A {
"TaskA"
}
task B -postcondition { return $false } {
"TaskB"
}
task C {
"TaskC"
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/missing_task_should_fail.ps1 | missing_task_should_fail.ps1 | task default -depends Test
task Test -depends Compile, Clean {
Write-Host "Running PSake"
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_properties_should_pass.ps1 | using_properties_should_pass.ps1 | properties {
$x = $null
$y = $null
$z = $null
}
task default -depends TestProperties
task TestProperties {
Assert ($x -ne $null) "x should not be null"
Assert ($y -ne $null) "y should not be null"
Assert ($z -eq $null) "z should be null"
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/bad_PreAndPostActions_should_fail.ps1 | bad_PreAndPostActions_should_fail.ps1 | task default -depends Test
task Test -depends Compile, Clean -PreAction {"Pre-Test"} -PostAction {"Post-Test"}
task Compile -depends Clean {
"Compile"
}
task Clean {
"Clean"
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/dotNet4.6.1_should_pass.ps1 | dotNet4.6.1_should_pass.ps1 | Framework "4.6.1"
task default -depends MsBuild
task MsBuild {
$output = &msbuild /version 2>&1
Assert ($output -NotLike "14.0") '$output should contain 14.0'
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/dotNet4_should_pass.ps1 | dotNet4_should_pass.ps1 | Framework '4.0'
task default -depends MsBuild
task MsBuild {
exec { msbuild /version }
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/nested_builds_that_fail_should_fail.ps1 | nested_builds_that_fail_should_fail.ps1 | Task default -Depends RunAlwaysFail
Task RunAlwaysFail {
Invoke-psake .\nested\always_fail.ps1
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_msbuild_should_pass.ps1 | using_msbuild_should_pass.ps1 | task default -depends DisplayNotice
task DisplayNotice {
exec { msbuild /version }
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/duplicate_tasks_should_fail.ps1 | duplicate_tasks_should_fail.ps1 | task A {}
task B {}
task A {} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/multiline_blocks_should_pass.ps1 | multiline_blocks_should_pass.ps1 | task default -depends doStuff
task doStuff {
"Starting to do stuff..."
"Adding stuff... 1 + 1 =" + (1+1)
"Stuff done!"
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/whatif_preference_should_pass.ps1 | whatif_preference_should_pass.ps1 | Task default -Depends RunWhatIf
Task RunWhatIf {
try {
## Setup the -whatif flag globally
$global:WhatIfPreference = $true
## Ensure that psake ends up by calling something with -whatif e.g. Set-Item
$parameters = @{p1='whatifcheck';}
Invoke-psake .\nested\whatifpreference.ps1 -parameters $p... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/nested_builds_should_pass.ps1 | nested_builds_should_pass.ps1 | Properties {
$x = 1
}
Task default -Depends RunNested1, RunNested2, CheckX
Task RunNested1 {
Invoke-psake .\nested\nested1.ps1
}
Task RunNested2 {
Invoke-psake .\nested\nested2.ps1
}
Task CheckX{
Assert ($x -eq 1) '$x was not 1'
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_PreAndPostActions_should_pass.ps1 | using_PreAndPostActions_should_pass.ps1 | task default -depends Test
task Test -depends Compile, Clean -PreAction {"Pre-Test"} -Action {
"Test"
} -PostAction {"Post-Test"}
task Compile -depends Clean {
"Compile"
}
task Clean {
"Clean"
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_required_when_set_should_pass.ps1 | using_required_when_set_should_pass.ps1 | properties {
$x = $null
$y = $null
}
task default -depends TestRequired
task TestRequired -requiredVariables x, y {
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/writing_psake_variables_should_pass.ps1 | writing_psake_variables_should_pass.ps1 | properties {
$x = 1
}
task default -depends Verify
task Verify -description "This task verifies psake's variables" {
#Verify the exported module variables
cd variable:
Assert (Test-Path "psake") "variable psake was not exported from module"
Assert ($psake.ContainsKey("build_success")) "'psake' variable d... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/nonzero_lastexitcode_should_pass.ps1 | nonzero_lastexitcode_should_pass.ps1 | task default -depends MSBuildWithError
task MSBuildWithError {
msbuild ThisFileDoesNotExist.sln
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/detailedDocs_should_pass.ps1 | detailedDocs_should_pass.ps1 |
Task default -depends CheckDetailedDocs
Task CheckDetailedDocs {
$doc = Invoke-psake .\nested\docs.ps1 -detailedDocs -nologo | Out-String
$expectedDoc = @"
Name : Compile
Alias :
Description :
Depends On : CompileSolutionA, CompileSolutionB
Default : True
Name : C... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/task_with_alias_and_dependencies_should_pass.ps1 | task_with_alias_and_dependencies_should_pass.ps1 | task default -depends Task_With_Alias
task Task_With_Alias -depends Task_Dependency -alias twa {}
task Task_Dependency {} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/running_aspnet_compiler_under_dotNet35_should_pass.ps1 | running_aspnet_compiler_under_dotNet35_should_pass.ps1 | Framework '3.5'
task default -depends AspNetCompiler
task AspNetCompiler {
aspnet_compiler
if ($LastExitCode -ne 1) {
throw 'Error: Could not execute aspnet_compiler'
}
$global:LastExitCode = 0
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_framework_should_pass.ps1 | using_framework_should_pass.ps1 | task default -depends FrameworkFunction
task FrameworkFunction {
AssertFramework '2.0'
AssertFramework '3.5'
AssertFramework '4.0'
}
function AssertFramework{
param(
[string]$framework
)
Framework $framework
$msBuildVersion = msbuild /version
Assert ($msBuildVersion[0].ToLower().StartsWith("microsoft (r) ... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/dotNet4.6_should_pass.ps1 | dotNet4.6_should_pass.ps1 | Framework "4.6"
task default -depends MsBuild
task MsBuild {
$output = &msbuild /version 2>&1
Assert ($output -NotLike "14.0") '$output should contain 14.0'
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_exec_and_nonzero_lastexitcode_should_fail.ps1 | using_exec_and_nonzero_lastexitcode_should_fail.ps1 | task default -depends MSBuildWithError
task MSBuildWithError {
exec { msbuild ThisFileDoesNotExist.sln }
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/explicitly_specified_32bit_build_should_pass.ps1 | explicitly_specified_32bit_build_should_pass.ps1 | Framework '4.0x86'
task default -depends MsBuild
task MsBuild {
exec { msbuild /version }
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/circular_dependency_in_tasks_should_fail.ps1 | circular_dependency_in_tasks_should_fail.ps1 | task default -depends A
task A -depends B { }
task B -depends A { }
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/dotNet4.5.1_should_pass.ps1 | dotNet4.5.1_should_pass.ps1 | Framework "4.5.1x86"
task default -depends MsBuild
task MsBuild {
$output = &msbuild /version 2>&1
Assert ($output -NotLike "12.0") '$output should contain 12.0'
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/Get-PSakeScriptTasks_should_pass.ps1 | Get-PSakeScriptTasks_should_pass.ps1 | Task default -depends CheckGetPSakeScriptTasks
function Assert-EqualArrays($a, $b, $message)
{
$differences = @(Compare-Object $a $b -SyncWindow 0)
if ($differences.Length -gt 0)
{
$differences
}
Assert ($differences.Length -eq 0) "$message : $($differences.Length) differences foun... |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/default_task_with_action_should_fail.ps1 | default_task_with_action_should_fail.ps1 | task default {
"Starting to do stuff..."
"Adding stuff... 1 + 1 =" + (1+1)
"Stuff done!"
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/task_with_alias_should_pass.ps1 | task_with_alias_should_pass.ps1 | task default -depends twbdn
task Task_With_Big_Descriptve_Name -alias twbdn {
"Doing stuff inside task with alias"
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/tasksetup_should_pass.ps1 | tasksetup_should_pass.ps1 | TaskSetup {
"executing task setup"
}
Task default -depends Compile, Test, Deploy
Task Compile {
"Compiling"
}
Task Test -depends Compile {
"Testing"
}
Task Deploy -depends Test {
"Deploying"
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_required_when_not_set_should_fail.ps1 | using_required_when_not_set_should_fail.ps1 | properties {
$x = $null
$y = $null
$z = $null
}
task default -depends TestProperties
task TestProperties -requiredVariables z{
}
|
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/using_parameters_should_pass.ps1 | using_parameters_should_pass.ps1 | properties {
$my_property = $p1 + $p2
}
task default -depends TestParams
task TestParams {
Assert ($my_property -ne $null) '$my_property should not be null'
} |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/modules/psake-config.ps1 | psake-config.ps1 | $config.modules = @("ModuleA.psm1", "ModuleB.psm1")
$config.moduleScope = "global" |
PowerShellCorpus/Github/csharris_psake-pester-test/psake/specs/modules/default.ps1 | default.ps1 | task default -depends test
task test {
Execute-ModuleAFunction
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.