-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add comments to the public API. Fix a few lexer/parsing issues
- Loading branch information
Showing
62 changed files
with
1,580 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2019 - Alexandre Mutel. All rights reserved. | ||
// Licensed under the BSD-Clause 2 license. | ||
// See license.txt file in the project root for full license information. | ||
|
||
using NUnit.Framework; | ||
|
||
namespace Tomlyn.Tests | ||
{ | ||
public static class AssertHelper | ||
{ | ||
public static void AreEqualNormalizeNewLine(string expected, string actual, string message = null) | ||
{ | ||
expected = NormalizeEndOfLine(expected); | ||
actual = NormalizeEndOfLine(actual); | ||
Assert.AreEqual(expected, actual, message); | ||
} | ||
|
||
public static string NormalizeEndOfLine(string text) | ||
{ | ||
return text.Replace("\r\n", "\n"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2019 - Alexandre Mutel. All rights reserved. | ||
// Licensed under the BSD-Clause 2 license. | ||
// See license.txt file in the project root for full license information. | ||
|
||
using NUnit.Framework; | ||
using Tomlyn.Syntax; | ||
|
||
namespace Tomlyn.Tests | ||
{ | ||
public class SyntaxTests | ||
{ | ||
[Test] | ||
public void TestDocument() | ||
{ | ||
var doc = new DocumentSyntax() | ||
{ | ||
Tables = | ||
{ | ||
new TableSyntax("test") | ||
{ | ||
Items = | ||
{ | ||
{"a", 1}, | ||
{"b", true }, | ||
{"c", "Check"}, | ||
{"d", "ToEscape\nWithAnotherChar\t" }, | ||
{"e", 12.5 }, | ||
{"f", new int[] {1,2,3,4} }, | ||
{"g", new string[] {"0", "1", "2"} }, | ||
{"key with space", 2} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
var docStr = doc.ToString(); | ||
|
||
var expected = @"[test] | ||
a = 1 | ||
b = true | ||
c = ""Check"" | ||
d = ""ToEscape\nWithAnotherChar\t"" | ||
e = 12.5 | ||
f = [1, 2, 3, 4] | ||
g = [""0"", ""1"", ""2""] | ||
""key with space"" = 2 | ||
"; | ||
|
||
AssertHelper.AreEqualNormalizeNewLine(expected, docStr); | ||
|
||
// Reparse the result and compare it again | ||
var newDoc = Toml.Parse(docStr); | ||
AssertHelper.AreEqualNormalizeNewLine(expected, newDoc.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright (c) $CURRENT_YEAR$ - Alexandre Mutel. All rights reserved.
 | ||
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright (c) Alexandre Mutel. All rights reserved.
 | ||
Licensed under the BSD-Clause 2 license. 
 | ||
See license.txt file in the project root for full license information.</s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RFC/@EntryIndexedValue">RFC</s:String> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Alexandre/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mutel/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Toml/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tomlyn/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tomlyn/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=trivias/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.