Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane32 committed Jun 28, 2021
1 parent cae3960 commit 3817ec2
Show file tree
Hide file tree
Showing 7 changed files with 841 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<VersionPrefix>7.1.0-preview</VersionPrefix>
<VersionPrefix>7.2.0-preview</VersionPrefix>
<LangVersion>8.0</LangVersion>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
41 changes: 41 additions & 0 deletions src/GraphQLParser.Tests/LexerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,47 @@ public void Lex_WhiteSpaceStringToken_HasStringKind()
token.Kind.ShouldBe(TokenKind.STRING);
}

[Theory]
[InlineData("test", "test")]
[InlineData("te\\\"\"\"st", "te\"\"\"st")]
[InlineData("\ntest", "test")]
[InlineData("\r\ntest", "test")]
[InlineData(" \ntest", "test")]
[InlineData("\t\ntest", "test")]
[InlineData("\n\ntest", "test")]
[InlineData("test\nline2", "test\nline2")]
[InlineData("test\rline2", "test\nline2")]
[InlineData("test\r\nline2", "test\nline2")]
[InlineData("test\r\r\nline2", "test\n\nline2")]
[InlineData("test\r\n\nline2", "test\n\nline2")]
[InlineData("test\n", "test")]
[InlineData("test\n ", "test")]
[InlineData("test\n\t", "test")]
[InlineData("test\n\n", "test")]
[InlineData("test\n line2", "test\nline2")]
[InlineData("test\n\t\tline2", "test\nline2")]
[InlineData("test\n \tline2", "test\nline2")]
[InlineData(" test\nline2", " test\nline2")]
[InlineData(" test\n line2", " test\nline2")]
[InlineData("\n test\n line2", "test\nline2")]
[InlineData(" test\n line2\n\t\tline3\n line4", " test\nline2\n\tline3\n line4")]
[InlineData(" test\n Hello,\n\n world!\n ", " test\nHello,\n\n world!")]
[InlineData(" \n Hello,\r\n\n world!\n ", "Hello,\n\n world!")]
[InlineData(" \n Hello,\r\n\n wor___ld!\n ", "Hello,\n\n wor___ld!")]
[InlineData("\r\n Hello,\r\n World!\r\n\r\n Yours,\r\n GraphQL.\r\n ", "Hello,\n World!\n\nYours,\n GraphQL.")]
[InlineData("Test \\n escaping", "Test \\n escaping")]
[InlineData("Test \\u1234 escaping", "Test \\u1234 escaping")]
[InlineData("Test \\ escaping", "Test \\ escaping")]
public void Lex_BlockString_Tests(string input, string expected)
{
input = input.Replace("___", new string('_', 9000));
expected = expected.Replace("___", new string('_', 9000));
input = "\"\"\"" + input + "\"\"\"";
var actual = input.Lex();
actual.Kind.ShouldBe(TokenKind.STRING);
actual.Value.ToString().ShouldBe(expected);
}

private static Token GetATPunctuationTokenLexer()
{
return "@".Lex();
Expand Down
Loading

0 comments on commit 3817ec2

Please sign in to comment.