Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-Fixture: case-insensitive evaluation of sut filename #428

Closed
bschwede opened this issue Dec 1, 2015 · 4 comments
Closed

New-Fixture: case-insensitive evaluation of sut filename #428

bschwede opened this issue Dec 1, 2015 · 4 comments

Comments

@bschwede
Copy link
Contributor

bschwede commented Dec 1, 2015

I don't no why it happend to me, may be I changed spelling of the ".Tests." filename infix manually or I didn't used the New-Fixture cmdlet to create the testfile in this case.

Due to the case-sensitive replacement the testfile included itself in a loop until the shell ran out of memory. It took me some time to understand it - silly me :-)

Perhaps the marked line could be changed in the New-Fixture code template from

$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")   # <====
. "$here\$sut"

to

$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.' 

in order to make it more robust.

@nohwnd
Copy link
Member

nohwnd commented Dec 2, 2015

Good idea. Created a PR for that.

@bschwede
Copy link
Contributor Author

bschwede commented Dec 3, 2015

Thanks.

This passage is also quoted in the following help files:

  • en-US\about_Mocking.help.txt: 46: $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
  • en-US\about_Pester.help.txt: 37: $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
  • en-US\about_Pester.help.txt: 74: $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
  • README.md: 37:$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")

Maybe this could also be updated.

@nohwnd
Copy link
Member

nohwnd commented Dec 4, 2015

Definitely. You should be able to edit the wiki directly if you want to do it yourself. Do you? Otherwise I can do it :)

@bschwede
Copy link
Contributor Author

bschwede commented Dec 5, 2015

I think I found all occurences in the wiki.

nohwnd added a commit that referenced this issue Dec 5, 2015
Case insensitive replacement of Test in help  #428
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants