提交 cf89264f 编写于 作者: T Tomas Matousek

Remove ExitCode from the host object

上级 3b06d826
......@@ -302,6 +302,7 @@ public async Task HostObjectBinding_DuplicateReferences()
{
typeof(object).GetTypeInfo().Assembly.Location,
typeof(C).Assembly.Location,
Assembly.Load(new AssemblyName("System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")).Location, // TODO: remove
typeof(C).Assembly.Location,
typeof(C).Assembly.Location,
}, s0.Script.GetCompilation().ExternalReferences.SelectAsArray(m => m.Display));
......
......@@ -108,17 +108,6 @@ public void Args()
> ", runner.Console.Out.ToString());
}
[Fact]
public void Script_ExitCode()
{
var script = Temp.CreateFile(extension: ".csx").WriteAllText("ExitCode = 42;");
var runner = CreateRunner(new[] { script.Path });
Assert.Equal(42, runner.RunInteractive());
Assert.Equal("", runner.Console.Out.ToString());
}
[Fact]
public void Script_NonExistingFile()
{
......
......@@ -150,7 +150,9 @@ private int RunScript(ScriptOptions options, string code, string scriptPath, Err
try
{
script.RunAsync(globals, cancellationToken).Wait();
return globals.ExitCode;
// TODO: use the return value of the script https://github.com/dotnet/roslyn/issues/5773
return CommonCompiler.Succeeded;
}
catch (CompilationErrorException e)
{
......
......@@ -33,11 +33,6 @@ public void Print(object value)
_outputWriter.WriteLine(_objectFormatter.FormatObject(value, PrintOptions));
}
/// <summary>
/// Script exit code. Use a non-zero number to indicate an error.
/// </summary>
public int ExitCode { get; set; }
internal ObjectFormattingOptions PrintOptions { get; }
public CommandLineScriptGlobals(TextWriter outputWriter, ObjectFormatter objectFormatter)
......
......@@ -3,8 +3,6 @@ Microsoft.CodeAnalysis.Scripting.CompilationErrorException.Diagnostics.get -> Sy
Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineScriptGlobals
Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineScriptGlobals.Args.get -> System.Collections.Generic.IList<string>
Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineScriptGlobals.CommandLineScriptGlobals(System.IO.TextWriter outputWriter, Microsoft.CodeAnalysis.Scripting.Hosting.ObjectFormatter objectFormatter) -> void
Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineScriptGlobals.ExitCode.get -> int
Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineScriptGlobals.ExitCode.set -> void
Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineScriptGlobals.Print(object value) -> void
Microsoft.CodeAnalysis.Scripting.Hosting.InteractiveAssemblyLoader
Microsoft.CodeAnalysis.Scripting.Hosting.InteractiveAssemblyLoader.Dispose() -> void
......
......@@ -8,9 +8,9 @@ namespace Microsoft.CodeAnalysis.Scripting.Hosting.UnitTests
{
public abstract class ObjectFormatterTestBase
{
internal static readonly ObjectFormattingOptions s_hexa = new ObjectFormattingOptions(useHexadecimalNumbers: true);
internal static readonly ObjectFormattingOptions s_memberList = new ObjectFormattingOptions(memberFormat: MemberDisplayFormat.List);
internal static readonly ObjectFormattingOptions s_inline = new ObjectFormattingOptions(memberFormat: MemberDisplayFormat.Inline);
internal static readonly ObjectFormattingOptions s_hexa = new ObjectFormattingOptions(useHexadecimalNumbers: true, maxOutputLength: int.MaxValue);
internal static readonly ObjectFormattingOptions s_memberList = new ObjectFormattingOptions(memberFormat: MemberDisplayFormat.List, maxOutputLength: int.MaxValue);
internal static readonly ObjectFormattingOptions s_inline = new ObjectFormattingOptions(memberFormat: MemberDisplayFormat.Inline, maxOutputLength: int.MaxValue);
public void AssertMembers(string str, params string[] expected)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册