Skip to content

Commit

Permalink
add more detailed test
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Dec 22, 2023
1 parent c34c8e1 commit 591f9cc
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions sdmap/test/sdmap.test/CommentTest.cs
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);
}
}

0 comments on commit 591f9cc

Please sign in to comment.