-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 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,52 @@ | ||
using sdmap.Compiler; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace sdmap.test; | ||
|
||
public class CommentTest | ||
{ | ||
[Fact] | ||
public void LineCommentShouldWorks() | ||
{ | ||
var code = "// comment should works here\nsql v1{WORKS}"; | ||
var rt = new SdmapCompiler(); | ||
rt.AddSourceCode(code); | ||
var result = rt.Emit("v1", null); | ||
Assert.Equal("WORKS", result); | ||
} | ||
|
||
[Fact] | ||
public void LineCommentWorksAfterSql() | ||
{ | ||
var code = "sql v1 // comment should works here\n{WORKS}"; | ||
var rt = new SdmapCompiler(); | ||
rt.AddSourceCode(code); | ||
var result = rt.Emit("v1", null); | ||
Assert.Equal("WORKS", result); | ||
} | ||
|
||
[Fact] | ||
public void BlockCommentShouldWorks() | ||
{ | ||
var code = "/* comment should works here\nalso can cross lines\n*/sql v1{WORKS}"; | ||
var rt = new SdmapCompiler(); | ||
rt.AddSourceCode(code); | ||
var result = rt.Emit("v1", null); | ||
Assert.Equal("WORKS", result); | ||
} | ||
|
||
[Fact] | ||
public void BlockCommentWorksAfterSql() | ||
{ | ||
var code = "sql v1 /* comment should works here\nalso can cross lines\n*/{WORKS}"; | ||
var rt = new SdmapCompiler(); | ||
rt.AddSourceCode(code); | ||
var result = rt.Emit("v1", null); | ||
Assert.Equal("WORKS", result); | ||
} | ||
} |