// [Fact] // public void DentedOnly() // { // var source = @" //namespace Foo // type Bar // func Baz"; // var expected = @" //►namespace Foo // ►type Bar // ►func Baz◄◄◄"; // AssertSourceEqualsTokenized(expected, source); // } // [Fact] // public void InsensitiveOnlyMultiLine() // { // var source = @"namespace Foo { // type Bar { // func Baz {} // } //}"; // AssertSourceEqualsTokenized(source, source); // } //[Fact] //public void InsensitiveOnlySingleLine() //{ // var source = "namespace Foo { type Bar { func Baz {} } }"; // AssertSourceEqualsTokenized(source, source); //} //[Fact] //public void SingleLineOnly() //{ // var source = "namespace Foo -> type Bar -> func Baz -> a = b"; // var expected = "namespace Foo -> type Bar -> func Baz -> a = b<ExpressionBodyEnd><ExpressionBodyEnd><ExpressionBodyEnd>"; // AssertSourceEqualsTokenized(expected, source); //} //[Fact] //public void SingleLineInsideInsensitiveOnly() //{ // var source = "namespace Foo { type Bar -> func Baz {} }"; // var expected = "namespace Foo { type Bar -> func Baz {} <ExpressionBodyEnd>}"; // AssertSourceEqualsTokenized(expected, source); //} //[Fact] //public void DentedInsideTwoSingleLines() //{ // var source = "namespace Foo -> type Bar -> func Baz\n\ta = b"; // var expected = "namespace Foo -> type Bar -> func Baz\n\t<Indent>a = b<Dedent><ExpressionBodyEnd><ExpressionBodyEnd>"; // AssertSourceEqualsTokenized(expected, source); //} //[Fact] //public void SingleLineInsideDentedInsideSingleLine() //{ // var source = "namespace Foo -> type Bar\n\tfunc Baz -> a = b"; // var expected = "namespace Foo -> type Bar\n\t<Indent>func Baz -> a = b<Dedent><ExpressionBodyEnd><ExpressionBodyEnd>"; // AssertSourceEqualsTokenized(expected, source); //} private void AssertSourceEqualsTokenized(String tokenized, String source) { var inputStream = new AntlrInputStream(source); var lexer = new CovaLexer(inputStream); string joinedTokens = String.Join(String.Empty, lexer.GetAllTokens().Select(x => x.Text)); Assert.Equal(tokenized, joinedTokens); }
public void NewlinesFile(String source, String expected) { var inputStream = new AntlrInputStream(source); var lexer = new CovaLexer(inputStream); string joinedTokens = String.Join(String.Empty, lexer.GetAllTokens().Select(x => x.Text)); Assert.Equal(expected, joinedTokens); }