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); }