Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Tomlet.Tests/BasicKeyValueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,18 @@ public void EmptyKeyNamesAreLegalIfQuoted()
Assert.Equal("", doc.Entries.Keys.First());
Assert.Equal("blank", Assert.IsType<TomlString>(doc.Entries[""]).Value);
}

[Fact]
public void BackslashesInQuotedKeysAreNotTurnedIntoEscapes()
{
var doc = GetDocument("'C:\\new' = 1\n'C:\\tools' = 2\n\"C:\\\\temp\" = 3\n\"tab\\there\" = 4");

Assert.Collection(doc.Entries.Keys,
key1 => Assert.Equal("C:\\new", key1),
key2 => Assert.Equal("C:\\tools", key2),
key3 => Assert.Equal("C:\\temp", key3),
key4 => Assert.Equal("tab\there", key4)
);
}
}
}
3 changes: 0 additions & 3 deletions Tomlet/TomlParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ private string ReadKey(TomletStringReader reader)
//Read unquoted key
key = ReadKeyInternal(reader, keyChar => keyChar.IsEquals() || keyChar.IsHashSign());

key = key.Replace("\\n", "\n")
.Replace("\\t", "\t");

return key;
}

Expand Down