forked from sprache/Sprache
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CommentParser eol issue sprache#184
- Loading branch information
1 parent
9d1721b
commit 86db56d
Showing
2 changed files
with
36 additions
and
1 deletion.
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
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,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Sprache.Tests | ||
{ | ||
public class CommentParserTest | ||
{ | ||
[Fact] | ||
public void Check_single_line_comment_for_both_eol_windows_linux() | ||
{ | ||
var parser = new CommentParser(); | ||
var expected = "this is a line comment"; | ||
var result = parser.SingleLineComment.Parse("//this is a line comment\r\nint i=5;"); | ||
Assert.Equal(result, expected); | ||
result = parser.SingleLineComment.Parse("//this is a line comment\nint i=5;"); | ||
Assert.Equal(result, expected); | ||
|
||
} | ||
[Fact] | ||
public void Check_any_comment_for_both_eol_windows_linux() | ||
{ | ||
var parser = new CommentParser(); | ||
var expected = "this is a line comment"; | ||
var result = parser.AnyComment.Parse("//this is a line comment\r\nint i=5;"); | ||
Assert.Equal(result, expected); | ||
result = parser.AnyComment.Parse("//this is a line comment\nint i=5;"); | ||
Assert.Equal(result, expected); | ||
|
||
} | ||
} | ||
} |