Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f532611

Browse filesBrowse files
committed
quote --configfile and added test
1 parent 92bcc44 commit f532611
Copy full SHA for f532611

File tree

2 files changed

+33
-8
lines changed
Filter options

2 files changed

+33
-8
lines changed

‎src/Dotnet.Script.DependencyModel/Context/DotnetRestorer.cs

Copy file name to clipboardExpand all lines: src/Dotnet.Script.DependencyModel/Context/DotnetRestorer.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ string CreateConfigFileArgument()
4646
{
4747
return string.IsNullOrWhiteSpace(projectFileInfo.NuGetConfigFile)
4848
? string.Empty
49-
: $"--configfile {projectFileInfo.NuGetConfigFile}";
49+
: $"--configfile \"{projectFileInfo.NuGetConfigFile}\"";
5050

5151
}
5252
}

‎src/Dotnet.Script.Tests/ScriptExecutionTests.cs

Copy file name to clipboardExpand all lines: src/Dotnet.Script.Tests/ScriptExecutionTests.cs
+32-7Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public void ShouldHandleLocalNuGetConfigWithRelativePath()
391391

392392
using (var packageLibraryFolder = new DisposableFolder())
393393
{
394-
CreateTestPackage(packageLibraryFolder);
394+
CreateTestPackage(packageLibraryFolder.Path);
395395

396396
string pathToScriptFile = CreateTestScript(packageLibraryFolder.Path);
397397

@@ -407,7 +407,7 @@ public void ShouldHandleLocalNuGetConfigWithRelativePathInParentFolder()
407407

408408
using (var packageLibraryFolder = new DisposableFolder())
409409
{
410-
CreateTestPackage(packageLibraryFolder);
410+
CreateTestPackage(packageLibraryFolder.Path);
411411

412412
var scriptFolder = Path.Combine(packageLibraryFolder.Path, "ScriptFolder");
413413
Directory.CreateDirectory(scriptFolder);
@@ -418,6 +418,26 @@ public void ShouldHandleLocalNuGetConfigWithRelativePathInParentFolder()
418418
}
419419
}
420420

421+
[Fact]
422+
public void ShouldHandleLocalNuGetFileWhenPathContainsSpace()
423+
{
424+
TestPathUtils.RemovePackageFromGlobalNugetCache("NuGetConfigTestLibrary");
425+
426+
using (var packageLibraryFolder = new DisposableFolder())
427+
{
428+
var packageLibraryFolderPath = Path.Combine(packageLibraryFolder.Path, "library folder");
429+
Directory.CreateDirectory(packageLibraryFolderPath);
430+
431+
CreateTestPackage(packageLibraryFolderPath);
432+
433+
string pathToScriptFile = CreateTestScript(packageLibraryFolderPath);
434+
435+
var result = ScriptTestRunner.Default.Execute($"\"{pathToScriptFile}\"");
436+
Assert.Contains("Success", result.output);
437+
}
438+
}
439+
440+
421441
private static string CreateTestScript(string scriptFolder)
422442
{
423443
string script = @"
@@ -429,11 +449,16 @@ private static string CreateTestScript(string scriptFolder)
429449
return pathToScriptFile;
430450
}
431451

432-
private static void CreateTestPackage(DisposableFolder packageLibraryFolder)
452+
private static void CreateTestPackage(string packageLibraryFolder)
453+
{
454+
ProcessHelper.RunAndCaptureOutput("dotnet", "new classlib -n NuGetConfigTestLibrary", packageLibraryFolder);
455+
var projectFolder = Path.Combine(packageLibraryFolder, "NuGetConfigTestLibrary");
456+
ProcessHelper.RunAndCaptureOutput("dotnet", $"pack -o \"{Path.Combine(packageLibraryFolder, "packagePath")}\"", projectFolder);
457+
CreateNuGetConfig(packageLibraryFolder);
458+
}
459+
460+
private static void CreateNuGetConfig(string packageLibraryFolder)
433461
{
434-
ProcessHelper.RunAndCaptureOutput("dotnet", "new classlib -n NuGetConfigTestLibrary", packageLibraryFolder.Path);
435-
var projectFolder = Path.Combine(packageLibraryFolder.Path, "NuGetConfigTestLibrary");
436-
ProcessHelper.RunAndCaptureOutput("dotnet", $"pack -o {Path.Combine(packageLibraryFolder.Path, "packagePath")}", projectFolder);
437462
string nugetConfig = @"
438463
<configuration>
439464
<packageSources>
@@ -442,7 +467,7 @@ private static void CreateTestPackage(DisposableFolder packageLibraryFolder)
442467
</packageSources>
443468
></configuration>
444469
";
445-
File.WriteAllText(Path.Combine(packageLibraryFolder.Path, "NuGet.Config"), nugetConfig);
470+
File.WriteAllText(Path.Combine(packageLibraryFolder, "NuGet.Config"), nugetConfig);
446471
}
447472
}
448473
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.