public CSharpLineMappingWriter(CSharpCodeWriter writer, SourceLocation documentLocation, int contentLength, string sourceFilename) : this(writer, documentLocation, contentLength) { _writePragmas = true; _writer.WriteLineNumberDirective(documentLocation, sourceFilename); _generatedLocation = _writer.GetCurrentSourceLocation(); }
public void WriteLineNumberDirective_UsesFilePath_WhenFileInSourceLocationIsNull() { // Arrange var filePath = "some-path"; var writer = new CSharpCodeWriter(); var expected = $"#line 5 \"{filePath}\"" + writer.NewLine; var sourceLocation = new SourceLocation(10, 4, 3); // Act writer.WriteLineNumberDirective(sourceLocation, filePath); var code = writer.GenerateCode(); // Assert Assert.Equal(expected, code); }
public CSharpLineMappingWriter(CSharpCodeWriter writer, SourceLocation documentLocation, int contentLength, string sourceFilename) : this(writer, documentLocation, contentLength) { _writePragmas = true; // TODO: Should this just be '\n'? if (!_writer.LastWrite.EndsWith("\n")) { _writer.WriteLine(); } _writer.WriteLineNumberDirective(documentLocation.LineIndex + 1, sourceFilename); _generatedLocation = _writer.GetCurrentSourceLocation(); }