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

Get-help may return multiple instances of the same help file #3410

Merged
merged 3 commits into from Mar 28, 2017
Jump to file or symbol
Failed to load files and symbols.
+16 −2
Diff settings

Always

Just for now

@@ -273,7 +273,11 @@ internal Collection<string> GetSearchPaths()
Diagnostics.Assert(searchPaths != null,
"HelpSystem returned an null search path");
searchPaths.Add(GetDefaultShellSearchPath());
string defaultShellSearchPath = GetDefaultShellSearchPath();
if (!searchPaths.Contains(defaultShellSearchPath))
{
searchPaths.Add(defaultShellSearchPath);
}
return searchPaths;
}
@@ -161,7 +161,7 @@ private void AddFiles(string muiDirectory, string directory, string pattern)
string leafFileName = Path.GetFileName(file);
string uniqueToDirectory = Path.Combine(directory, leafFileName);
if (!_uniqueMatches.Contains(uniqueToDirectory))
if (!_result.Contains(path) && !_uniqueMatches.Contains(uniqueToDirectory))
{
_result.Add(path);
_uniqueMatches[uniqueToDirectory] = true;
@@ -180,3 +180,13 @@ Describe "Validate that Get-Help returns provider-specific help" -Tags @('CI', '
}
}
}
Describe "Validate about_help.txt under culture specific folder works" -Tags @('CI') {
It "Get-Help about_should should return help text and not multiple HelpInfo objects" {
$help = Get-Help about_should

This comment has been minimized.

@iSazonov

iSazonov Mar 24, 2017

Collaborator

Should we use an existing file for the test? Could we create temporary files?

@iSazonov

iSazonov Mar 24, 2017

Collaborator

Should we use an existing file for the test? Could we create temporary files?

This comment has been minimized.

@SteveL-MSFT

SteveL-MSFT Mar 24, 2017

Member

Since the test itself relies on Pester, I think it would be ok to depend on it.

@SteveL-MSFT

SteveL-MSFT Mar 24, 2017

Member

Since the test itself relies on Pester, I think it would be ok to depend on it.

This comment has been minimized.

@iSazonov

iSazonov Mar 24, 2017

Collaborator

My thought was that if someone is going to have to improve Help System and to rename this file, the test will fail while has no relationship to the improvements.

@iSazonov

iSazonov Mar 24, 2017

Collaborator

My thought was that if someone is going to have to improve Help System and to rename this file, the test will fail while has no relationship to the improvements.

This comment has been minimized.

@SteveL-MSFT

SteveL-MSFT Mar 24, 2017

Member

about_should belongs to Pester so we wouldn't rename it. I can create test only help files to replace this. I agree it would be more clean that way.

@SteveL-MSFT

SteveL-MSFT Mar 24, 2017

Member

about_should belongs to Pester so we wouldn't rename it. I can create test only help files to replace this. I agree it would be more clean that way.

$help.count | Should Be 1
$help | Should BeOfType System.String
}
}
ProTip! Use n and p to navigate between commits in a pull request.