Stephanevg / PSClassUtils

A set of utilities to work with Powershell Classes
http://powershelldistrict.com/how-to-generate-a-uml-diagram-using-powershell/
91 stars 23 forks source link

Write-CuPesterTests dot sourcing needs double quotes #107

Open Stephanevg opened 5 years ago

Stephanevg commented 5 years ago

Add support for dot sourcing with spaces in path Result

. C:\Users\taavast3\OneDrive\UserGroups\Presentations\2019.06.PsConf2019\Learn classes with Class\Code\02.CheatingTDD.Class.Polymorphism.ps1
Describe '[Animal]-[Constructors]'{

}# end of Describe block
Describe '[Cat]-[Constructors]'{

It '[Cat]-[Constructor]([String]Name) should Not Throw' {

# -- Arrange

[String]$Name=''

# -- Act

# -- Assert

{[Cat]::New($Name)} | Should Not Throw 

}# end of it block

Should be

. "C:\Users\taavast3\OneDrive\UserGroups\Presentations\2019.06.PsConf2019\Learn classes with Class\Code\02.CheatingTDD.Class.Polymorphism.ps1"
Describe '[Animal]-[Constructors]'{

}# end of Describe block
Describe '[Cat]-[Constructors]'{

It '[Cat]-[Constructor]([String]Name) should Not Throw' {

# -- Arrange

[String]$Name=''

# -- Act

# -- Assert

{[Cat]::New($Name)} | Should Not Throw 

}# end of it block
LxLeChat commented 5 years ago

Quick fix, change line 172, added simple quotes, in write-cupestertests.ps1

[void]$sb.AppendLine(". '$($File.Name)'")