public void Empty_standard_out_with_instrumentation_remains_empty_after_extraction()
            {
                InstrumentedOutputExtractor.ExtractOutput(
                    new[] {
                    _sentinel,
                    #region variableLocation
                    @"
{
""variableLocations"": [
    {
        ""name"": ""b"",
        ""locations"": [
          {
            ""startLine"": 12,
            ""startColumn"": 16,
            ""endLine"": 12,
            ""endColumn"": 21
          }
        ],
        ""declaredAt"": {
          ""start"": 176,
          ""end"": 181
        }
    }
]
}",
                    #endregion
                    _sentinel + _sentinel,
                    #region programState
                    @"
{
      ""filePosition"": {
        ""line"": 12,
        ""character"": 12,
        ""file"": ""Program.cs""
      },
      ""stackTrace"": ""    at FibonacciTest.Program.Main()\r\n "",
      ""locals"": [
        {
          ""name"": ""a"",
          ""value"": ""4"",
          ""declaredAt"": {
            ""start"": 153,
            ""end"": 154
          }
        }
      ],
      ""parameters"": [],
      ""fields"": []
}
",
                    #endregion
                    _sentinel
                }
                    ).StdOut.Count().Should().Be(0);
            }
Beispiel #2
0
        private static async Task <RunResult> RunConsoleAsync(
            Package package,
            IEnumerable <SerializableDiagnostic> diagnostics,
            Budget budget,
            string requestId,
            bool includeInstrumentation,
            string commandLineArgs)
        {
            var dotnet = new Dotnet(package.Directory);

            var commandName       = $@"""{package.EntryPointAssemblyPath.FullName}""";
            var commandLineResult = await dotnet.Execute(
                commandName.AppendArgs(commandLineArgs),
                budget);

            budget.RecordEntry(UserCodeCompleted);

            var output = InstrumentedOutputExtractor.ExtractOutput(commandLineResult.Output);

            if (commandLineResult.ExitCode == 124)
            {
                throw new BudgetExceededException(budget);
            }

            string exceptionMessage = null;

            if (commandLineResult.Error.Count > 0)
            {
                exceptionMessage = string.Join(Environment.NewLine, commandLineResult.Error);
            }

            var runResult = new RunResult(
                succeeded: true,
                output: output.StdOut,
                exception: exceptionMessage,
                diagnostics: diagnostics,
                requestId: requestId);

            if (includeInstrumentation)
            {
                runResult.AddFeature(output.ProgramStatesArray);
                runResult.AddFeature(output.ProgramDescriptor);
            }

            return(runResult);
        }
 public void Empty_standard_out_remains_empty_after_extraction()
 {
     InstrumentedOutputExtractor.ExtractOutput(new string[] { })
     .StdOut.Count().Should().Be(0);
 }
        public InstrumentedOutputExtractorTests()
        {
            var normalizedOutput = instrumentedProgramOutput.Select(line => line.EnforceLF()).ToArray();

            splitOutput = InstrumentedOutputExtractor.ExtractOutput(normalizedOutput);
        }