Skip to content

Commit

Permalink
GenerateDefaultInstall tests, for KSP-CKAN#127.
Browse files Browse the repository at this point in the history
Seriously folks, write more tests, they're awesome.
  • Loading branch information
pjf committed Oct 22, 2014
1 parent b198e4a commit 47a210b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ModuleInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ private string Sha1Sum(string path)
/// Returns a default install stanza for the module provided. This finds the topmost
/// directory which matches the module identifier, and installs that into GameData.
/// </summary>
internal ModuleInstallDescriptor GenerateDefaultInstall(CkanModule module, ZipFile zipfile)
internal static ModuleInstallDescriptor GenerateDefaultInstall(string identifier, ZipFile zipfile)
{
var stanza = new ModuleInstallDescriptor();
stanza.description = "Default install (autogenerated)";
Expand All @@ -462,15 +462,15 @@ internal ModuleInstallDescriptor GenerateDefaultInstall(CkanModule module, ZipFi
// don't include entries for directories, but still include entries
// for the files they contain.

string ident_filter = @"(^|/|\\)" + Regex.Escape(module.identifier) + @"$";
string ident_filter = @"(^|/|\\)" + Regex.Escape(identifier) + @"$";

// Let's find that directory
foreach (ZipEntry entry in zipfile)
{
string directory = Path.GetDirectoryName(entry.Name);

// If this looks like what we're after, remember it.
if (Regex.IsMatch(directory, ident_filter))
if (Regex.IsMatch(directory, ident_filter, RegexOptions.IgnoreCase ))
{
candidate_set.Add(directory);
}
Expand Down
3 changes: 3 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

// Tests can see our internals.
[assembly: InternalsVisibleTo("Tests")]

// NB: The CKAN build/release process appends an AssemblyInformationalVersion to this file.

0 comments on commit 47a210b

Please sign in to comment.