Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpar committed Jul 10, 2023
1 parent 3b3c42b commit fd05146
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
20 changes: 14 additions & 6 deletions src/Compilers/Core/MSBuildTaskTests/VbcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@
using Microsoft.CodeAnalysis.BuildTasks.UnitTests.TestUtilities;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.CodeAnalysis.BuildTasks.UnitTests
{
public sealed class VbcTests
{
public ITestOutputHelper TestOutputHelper { get; }

public VbcTests(ITestOutputHelper testOutputHelper)
{
TestOutputHelper = testOutputHelper;
}

[Fact]
public void SingleSource()
{
Expand Down Expand Up @@ -523,28 +531,28 @@ public void ReportIVTsSwitch()
[Fact]
public void CommandLineArgs1()
{
var engine = new MockEngine();
var csc = new Csc()
var engine = new MockEngine(TestOutputHelper);
var csc = new Vbc()
{
BuildEngine = engine,
Sources = MSBuildUtil.CreateTaskItems("test.vb"),
};

TaskTestUtil.AssertCommandLine(csc, engine, "/out:test.exe", "test.vb");
TaskTestUtil.AssertCommandLine(csc, engine, "/optionstrict:custom", "/out:test.exe", "test.vb");
}

[Fact]
public void CommandLineArgs2()
{
var engine = new MockEngine();
var csc = new Csc()
var engine = new MockEngine(TestOutputHelper);
var csc = new Vbc()
{
BuildEngine = engine,
Sources = MSBuildUtil.CreateTaskItems("test.vb", "blah.vb"),
TargetType = "library"
};

TaskTestUtil.AssertCommandLine(csc, engine, "/out:test.dll", "/target:library", "test.vb", "blah.vb");
TaskTestUtil.AssertCommandLine(csc, engine, "/optionstrict:custom", "/out:test.dll", "/target:library", "test.vb", "blah.vb");
}
}
}
8 changes: 4 additions & 4 deletions src/Compilers/Shared/RuntimeHostInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ internal static (string processFilePath, string commandLineArguments, string too
/// </summary>
internal static string GetDotNetPathOrDefault()
{
var (fileName, sep) = PlatformInformation.IsWindows
? ("dotnet.exe", ';')
: ("dotnet", ':');
if (Environment.GetEnvironmentVariable("DOTNET_ROOT") is { } rootStr)
{
return rootStr;
return Path.Combine(rootStr, fileName);
}

var (fileName, sep) = PlatformInformation.IsWindows
? ("dotnet.exe", ';')
: ("dotnet", ':');
var path = Environment.GetEnvironmentVariable("PATH") ?? "";
foreach (var item in path.Split(sep, StringSplitOptions.RemoveEmptyEntries))
{
Expand Down

0 comments on commit fd05146

Please sign in to comment.