From 4cb9da417028fddef702f2152f18255593fd3dc8 Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Wed, 11 Oct 2023 09:55:16 +0300 Subject: [PATCH 1/9] Bump xunit and related fixes --- src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj | 4 ++-- src/GraphQLParser.Tests/GraphQLParser.Tests.csproj | 6 +++--- src/GraphQLParser.Tests/Visitors/ASTVisitorTests.cs | 8 ++++---- src/GraphQLParser.Tests/Visitors/CountVisitorTests.cs | 4 ++-- src/GraphQLParser.Tests/Visitors/MaxDepthVisitorTests.cs | 2 +- .../Visitors/SDLPrinterFromParsedTextTests.cs | 6 +++--- .../Visitors/SDLPrinterSkipDirectivesTests.cs | 2 +- .../Visitors/SDLPrinterVerticalIndentationTests.cs | 2 +- src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs | 8 ++++---- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj index 3ad1ee81..36734205 100644 --- a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj +++ b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj index c0da9b5d..9eecc416 100644 --- a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj +++ b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj @@ -13,7 +13,7 @@ - netcoreapp3.1;net5;net6;net7 + net6;net7 @@ -27,8 +27,8 @@ - - + + diff --git a/src/GraphQLParser.Tests/Visitors/ASTVisitorTests.cs b/src/GraphQLParser.Tests/Visitors/ASTVisitorTests.cs index 9f1be0e9..ffe9d87f 100644 --- a/src/GraphQLParser.Tests/Visitors/ASTVisitorTests.cs +++ b/src/GraphQLParser.Tests/Visitors/ASTVisitorTests.cs @@ -23,17 +23,17 @@ public void ASTVisitor_Should_Handle_Null() } [Fact] - public void ASTVisitor_Should_Throw_On_Unknown_Node() + public async Task ASTVisitor_Should_Throw_On_Unknown_Node() { var visitor = new ASTVisitor(); var context = new Context(); - var ex = Should.Throw(() => visitor.VisitAsync(new MySuperNode(), context).GetAwaiter().GetResult()); + var ex = await Should.ThrowAsync(async () => await visitor.VisitAsync(new MySuperNode(), context)); ex.Message.ShouldBe("Unknown node 'MySuperNode'."); } [Fact] - public void ASTVisitor_Should_Pass_CancellationToken() + public async Task ASTVisitor_Should_Pass_CancellationToken() { var document = "scalar JSON".Parse(); var visitor = new MyVisitor(); @@ -41,7 +41,7 @@ public void ASTVisitor_Should_Pass_CancellationToken() var context = new Context { CancellationToken = cts.Token }; context.CancellationToken.ThrowIfCancellationRequested(); - Should.Throw(() => visitor.VisitAsync(document, context).GetAwaiter().GetResult()); + await Should.ThrowAsync(async () => await visitor.VisitAsync(document, context)); } private sealed class MyVisitor : ASTVisitor diff --git a/src/GraphQLParser.Tests/Visitors/CountVisitorTests.cs b/src/GraphQLParser.Tests/Visitors/CountVisitorTests.cs index d36dac64..57ea0024 100644 --- a/src/GraphQLParser.Tests/Visitors/CountVisitorTests.cs +++ b/src/GraphQLParser.Tests/Visitors/CountVisitorTests.cs @@ -38,7 +38,7 @@ public async Task CountVisitor_Should_Count_Nodes(string text, int expectedCount var document = text.Parse(); - await visitor.VisitAsync(document, context).ConfigureAwait(false); + await visitor.VisitAsync(document, context); context.Count.ShouldBe(expectedCount); document.AllNestedCount().ShouldBe(expectedCount); } @@ -55,7 +55,7 @@ public async Task CountVisitor_Should_Count_Zero_Nodes(string text) var document = text.Parse(); - await visitor.VisitAsync(document, context).ConfigureAwait(false); + await visitor.VisitAsync(document, context); context.Count.ShouldBe(0); } } diff --git a/src/GraphQLParser.Tests/Visitors/MaxDepthVisitorTests.cs b/src/GraphQLParser.Tests/Visitors/MaxDepthVisitorTests.cs index 0d7a9ad3..9040fafe 100644 --- a/src/GraphQLParser.Tests/Visitors/MaxDepthVisitorTests.cs +++ b/src/GraphQLParser.Tests/Visitors/MaxDepthVisitorTests.cs @@ -22,7 +22,7 @@ public async Task MaxDepthVisitor_Should_Work(string text, int expectedMaxDepth) var document = text.Parse(); - await visitor.VisitAsync(document, context).ConfigureAwait(false); + await visitor.VisitAsync(document, context); context.MaxDepth.ShouldBe(expectedMaxDepth); document.MaxNestedDepth().ShouldBe(expectedMaxDepth); } diff --git a/src/GraphQLParser.Tests/Visitors/SDLPrinterFromParsedTextTests.cs b/src/GraphQLParser.Tests/Visitors/SDLPrinterFromParsedTextTests.cs index 935d47b9..81660070 100644 --- a/src/GraphQLParser.Tests/Visitors/SDLPrinterFromParsedTextTests.cs +++ b/src/GraphQLParser.Tests/Visitors/SDLPrinterFromParsedTextTests.cs @@ -867,7 +867,7 @@ public async Task SDLPrinter_Should_Print_Document( var writer = new StringWriter(); var document = text.Parse(); - await printer.PrintAsync(document, writer).ConfigureAwait(false); + await printer.PrintAsync(document, writer); var actual = writer.ToString(); actual.ShouldBe(expected, $"Test {number} failed"); @@ -924,7 +924,7 @@ public async Task SDLPrinter_Should_Print_BlockStrings(int number, string input, var document = (input + " scalar a").Parse(); var printer = new SDLPrinter(); - await printer.PrintAsync(document, writer).ConfigureAwait(false); + await printer.PrintAsync(document, writer); var renderedOriginal = writer.ToString(); var lines = renderedOriginal.Split(Environment.NewLine); @@ -955,7 +955,7 @@ public async Task SDLPrinter_Should_Print_EscapedStrings(string stringValue) var document = query.Parse(); var printer = new SDLPrinter(); - await printer.PrintAsync(document, writer).ConfigureAwait(false); + await printer.PrintAsync(document, writer); var rendered = writer.ToString(); rendered.ShouldBe(expected); diff --git a/src/GraphQLParser.Tests/Visitors/SDLPrinterSkipDirectivesTests.cs b/src/GraphQLParser.Tests/Visitors/SDLPrinterSkipDirectivesTests.cs index 18746642..926ccee5 100644 --- a/src/GraphQLParser.Tests/Visitors/SDLPrinterSkipDirectivesTests.cs +++ b/src/GraphQLParser.Tests/Visitors/SDLPrinterSkipDirectivesTests.cs @@ -54,7 +54,7 @@ public async Task Printer_Should_Print_Pretty_If_Directives_Skipped( var writer = new StringWriter(); var document = text.Parse(); - await printer.PrintAsync(document, writer).ConfigureAwait(false); + await printer.PrintAsync(document, writer); var actual = writer.ToString(); actual.ShouldBe(expected, $"Test {number} failed"); diff --git a/src/GraphQLParser.Tests/Visitors/SDLPrinterVerticalIndentationTests.cs b/src/GraphQLParser.Tests/Visitors/SDLPrinterVerticalIndentationTests.cs index a22b58b5..2939c3ff 100644 --- a/src/GraphQLParser.Tests/Visitors/SDLPrinterVerticalIndentationTests.cs +++ b/src/GraphQLParser.Tests/Visitors/SDLPrinterVerticalIndentationTests.cs @@ -186,7 +186,7 @@ public async Task Printer_Should_Print_Pretty_If_Definitions_Skipped( var writer = new StringWriter(); var document = text.Parse(); - await printer.PrintAsync(document, writer).ConfigureAwait(false); + await printer.PrintAsync(document, writer); var actual = writer.ToString(); actual.ShouldBe(expected, $"Test {number} failed"); diff --git a/src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs b/src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs index 857e0dce..b3b0277c 100644 --- a/src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs +++ b/src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs @@ -285,7 +285,7 @@ public async Task StructurePrinter_Should_Print_Tree(string text, string expecte { var writer = new StringWriter(); var document = text.Parse(); - await _structPrinter1.PrintAsync(document, writer).ConfigureAwait(false); + await _structPrinter1.PrintAsync(document, writer); var actual = writer.ToString(); actual.ShouldBe(expected); } @@ -304,7 +304,7 @@ public async Task StructurePrinter_Should_Print_Tree_Without_Names(string text, { var writer = new StringWriter(); var document = text.Parse(); - await _structPrinter2.PrintAsync(document, writer).ConfigureAwait(false); + await _structPrinter2.PrintAsync(document, writer); var actual = writer.ToString(); actual.ShouldBe(expected); } @@ -550,7 +550,7 @@ public async Task StructurePrinter_Should_Print_Tree_With_Locations(string text, var writer = new StringWriter(); var document = text.Parse(new ParserOptions { Ignore = option }); - await _structPrinter3.PrintAsync(document, writer).ConfigureAwait(false); + await _structPrinter3.PrintAsync(document, writer); var actual = writer.ToString(); actual.ShouldBe(expected); } @@ -587,7 +587,7 @@ public async Task StructurePrinter_Should_Print_Tree_With_Custom_Indentation(str var document = text.Parse(new ParserOptions { Ignore = option }); var printer = new StructurePrinter(new StructurePrinterOptions { PrintNames = false, IndentSize = indentSize }); - await printer.PrintAsync(document, writer).ConfigureAwait(false); + await printer.PrintAsync(document, writer); var actual = writer.ToString(); actual.ShouldBe(expected); } From 4418297d6c3991123db571a6a821607ebcaa4531 Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Wed, 11 Oct 2023 18:50:22 +0300 Subject: [PATCH 2/9] ci --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 298a51e1..2fc91ce0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ on: branches: - master - develop - - v8 + - v8 paths: - src/** - .github/workflows/** @@ -36,8 +36,6 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 3.1.x - 5.0.x 6.0.x 7.0.x source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json From e3a9fd475d2bc7edea79ea2fc6a8b2798c684110 Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Thu, 12 Oct 2023 08:10:12 +0300 Subject: [PATCH 3/9] down the rabbit hole --- .github/workflows/test.yml | 1 + .../GraphQLParser.Tests.csproj | 4 ++-- .../Visitors/SDLPrinterFromParsedTextTests.cs | 4 ++-- src/GraphQLParser/GraphQLParser.csproj | 8 +++++--- .../Visitors/PrintContextExtensions.cs | 2 +- .../Visitors/SDLPrinterExtensions.cs | 17 ++++++++++++++++- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2fc91ce0..6653e4fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,6 +36,7 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | + 3.1.x 6.0.x 7.0.x source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json diff --git a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj index 9eecc416..7863fc6f 100644 --- a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj +++ b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj @@ -13,7 +13,7 @@ - net6;net7 + netcoreapp3.1;net6;net7;net462 @@ -28,7 +28,7 @@ - + diff --git a/src/GraphQLParser.Tests/Visitors/SDLPrinterFromParsedTextTests.cs b/src/GraphQLParser.Tests/Visitors/SDLPrinterFromParsedTextTests.cs index 81660070..0fdff1e3 100644 --- a/src/GraphQLParser.Tests/Visitors/SDLPrinterFromParsedTextTests.cs +++ b/src/GraphQLParser.Tests/Visitors/SDLPrinterFromParsedTextTests.cs @@ -927,8 +927,8 @@ public async Task SDLPrinter_Should_Print_BlockStrings(int number, string input, await printer.PrintAsync(document, writer); var renderedOriginal = writer.ToString(); - var lines = renderedOriginal.Split(Environment.NewLine); - var renderedDescription = string.Join(Environment.NewLine, lines.SkipLast(1)); + var lines = renderedOriginal.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); + var renderedDescription = string.Join(Environment.NewLine, lines.Take(lines.Length - 1)); renderedDescription = renderedDescription.Replace("\r\n", "\n"); renderedDescription.ShouldBe(expected); diff --git a/src/GraphQLParser/GraphQLParser.csproj b/src/GraphQLParser/GraphQLParser.csproj index 14324596..532f096b 100644 --- a/src/GraphQLParser/GraphQLParser.csproj +++ b/src/GraphQLParser/GraphQLParser.csproj @@ -4,15 +4,17 @@ Library containing lexer and parser for GraphQL syntax GraphQL Parser GraphQL Parser for .NET - netstandard2.0;netstandard2.1;net6 + netstandard2.0;netstandard2.1;net6;net462 GraphQL-Parser GraphQL;json;api;parser <_FriendAssembliesPublicKey>PublicKey=0024000004800000940000000602000000240000525341310004000001000100352162dbf27be78fc45136884b8f324aa9f1dfc928c96c24704bf1df1a8779b2f26c760ed8321eca5b95ea6bd9bb60cd025b300f73bd1f4ae1ee6e281f85c527fa013ab5cb2c3fc7a1cbef7f9bf0c9014152e6a21f6e0ac6a371f8b45c6d7139c9119df9eeecf1cf59063545bb7c07437b1bc12be2c57d108d72d6c27176fbb8 - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/GraphQLParser/Visitors/PrintContextExtensions.cs b/src/GraphQLParser/Visitors/PrintContextExtensions.cs index 96bd40f5..36fe4a94 100644 --- a/src/GraphQLParser/Visitors/PrintContextExtensions.cs +++ b/src/GraphQLParser/Visitors/PrintContextExtensions.cs @@ -25,7 +25,7 @@ public static ValueTask WriteAsync(this TContext context, ROM value) context.IndentPrinted = false; var task = -#if NETSTANDARD2_0 +#if NETSTANDARD2_0 || NET462 // no cancellationToken support on netstandard2.0 context.Writer.WriteAsync(value.ToString()); //ISSUE: allocation - either WriteAsync(value.ToString()) or Write(char value) in a loop #elif NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER diff --git a/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs b/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs index 94f7176c..d581a78d 100644 --- a/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs +++ b/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs @@ -26,13 +26,28 @@ public static void Print(this SDLPrinter printer, ASTNode node, StringBuilder st => printer.PrintAsync(node, new StringWriter(stringBuilder), default).GetAwaiter().GetResult(); #pragma warning restore CA2012 // Use ValueTasks correctly +#if NET462 + private static readonly Encoding _uTF8NoBOM = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); +#endif + /// /// Prints the specified AST into the specified as a SDL document. /// If no encoding is specified, the document is written in UTF-8 format without a byte order mark. /// public static void Print(this SDLPrinter printer, ASTNode node, MemoryStream memoryStream, Encoding? encoding = null) { - using var streamWriter = new StreamWriter(memoryStream, encoding, -1 /* default */, true); + int bufferSize = -1; +#if NET462 + if (encoding == null) + { + encoding = _uTF8NoBOM; + } + if (bufferSize == -1) + { + bufferSize = 1024; + } +#endif + using var streamWriter = new StreamWriter(memoryStream, encoding, bufferSize, true); #pragma warning disable CA2012 // Use ValueTasks correctly printer.PrintAsync(node, streamWriter, default).GetAwaiter().GetResult(); #pragma warning restore CA2012 // Use ValueTasks correctly From e9a257e74cff6c040eb2f8cb14f474821c836c52 Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Thu, 12 Oct 2023 08:29:21 +0300 Subject: [PATCH 4/9] style --- src/GraphQLParser/Visitors/SDLPrinterExtensions.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs b/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs index b2d63d4f..06d862f6 100644 --- a/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs +++ b/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs @@ -36,14 +36,9 @@ public static void Print(this SDLPrinter printer, ASTNode node, MemoryStream mem { int bufferSize = -1; #if NET462 - if (encoding == null) - { - encoding = _uTF8NoBOM; - } + encoding ??= _uTF8NoBOM; if (bufferSize == -1) - { bufferSize = 1024; - } #endif using var streamWriter = new StreamWriter(memoryStream, encoding, bufferSize, true); printer.PrintAsync(node, streamWriter, default).AsTask().GetAwaiter().GetResult(); From 0e713306adb0f9529a04fff8bb7c16a389f68e83 Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Thu, 12 Oct 2023 11:40:58 +0300 Subject: [PATCH 5/9] net462 out --- src/GraphQLParser/GraphQLParser.csproj | 8 +++----- src/GraphQLParser/Visitors/SDLPrinterExtensions.cs | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/GraphQLParser/GraphQLParser.csproj b/src/GraphQLParser/GraphQLParser.csproj index 532f096b..14324596 100644 --- a/src/GraphQLParser/GraphQLParser.csproj +++ b/src/GraphQLParser/GraphQLParser.csproj @@ -4,17 +4,15 @@ Library containing lexer and parser for GraphQL syntax GraphQL Parser GraphQL Parser for .NET - netstandard2.0;netstandard2.1;net6;net462 + netstandard2.0;netstandard2.1;net6 GraphQL-Parser GraphQL;json;api;parser <_FriendAssembliesPublicKey>PublicKey=0024000004800000940000000602000000240000525341310004000001000100352162dbf27be78fc45136884b8f324aa9f1dfc928c96c24704bf1df1a8779b2f26c760ed8321eca5b95ea6bd9bb60cd025b300f73bd1f4ae1ee6e281f85c527fa013ab5cb2c3fc7a1cbef7f9bf0c9014152e6a21f6e0ac6a371f8b45c6d7139c9119df9eeecf1cf59063545bb7c07437b1bc12be2c57d108d72d6c27176fbb8 - - - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs b/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs index 06d862f6..0033200e 100644 --- a/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs +++ b/src/GraphQLParser/Visitors/SDLPrinterExtensions.cs @@ -24,7 +24,7 @@ public static string Print(this SDLPrinter printer, ASTNode node) public static void Print(this SDLPrinter printer, ASTNode node, StringBuilder stringBuilder) => printer.PrintAsync(node, new StringWriter(stringBuilder), default).AsTask().GetAwaiter().GetResult(); -#if NET462 +#if !NET6_0_OR_GREATER private static readonly Encoding _uTF8NoBOM = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); #endif @@ -35,7 +35,7 @@ public static void Print(this SDLPrinter printer, ASTNode node, StringBuilder st public static void Print(this SDLPrinter printer, ASTNode node, MemoryStream memoryStream, Encoding? encoding = null) { int bufferSize = -1; -#if NET462 +#if !NET6_0_OR_GREATER encoding ??= _uTF8NoBOM; if (bufferSize == -1) bufferSize = 1024; From 039486c2444785468cd80497ba6da955a2d3e9ff Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Thu, 12 Oct 2023 15:32:40 +0300 Subject: [PATCH 6/9] fix? --- src/GraphQLParser.Tests/GraphQLParser.Tests.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj index 7863fc6f..0a4f7334 100644 --- a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj +++ b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj @@ -29,6 +29,8 @@ + + From 4bf5864b0331c6b5c34739270b187644b3a864e8 Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Thu, 12 Oct 2023 15:41:44 +0300 Subject: [PATCH 7/9] test --- src/GraphQLParser.Tests/MemoryTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GraphQLParser.Tests/MemoryTests.cs b/src/GraphQLParser.Tests/MemoryTests.cs index de577618..b1daa735 100644 --- a/src/GraphQLParser.Tests/MemoryTests.cs +++ b/src/GraphQLParser.Tests/MemoryTests.cs @@ -151,7 +151,7 @@ public void Casted_To_String_From_Original_String_Should_Be_Equal(string str) // so no heap allocation when ROM is actually backed by whole string object ReferenceEquals(rom.ToString(), str).ShouldBeTrue(); - ReferenceEquals((string)rom, str).ShouldBeTrue(); + //ReferenceEquals((string)rom, str).ShouldBeTrue(); } [Fact(Skip = "Known issue with ROM - it cannot represent null values")] From 82a07645ccc6b439a9afc3b5385b16d6278073fe Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Thu, 12 Oct 2023 15:54:49 +0300 Subject: [PATCH 8/9] test2 --- src/GraphQLParser.Tests/MemoryTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GraphQLParser.Tests/MemoryTests.cs b/src/GraphQLParser.Tests/MemoryTests.cs index b1daa735..5d5c4aeb 100644 --- a/src/GraphQLParser.Tests/MemoryTests.cs +++ b/src/GraphQLParser.Tests/MemoryTests.cs @@ -150,8 +150,8 @@ public void Casted_To_String_From_Original_String_Should_Be_Equal(string str) ROM rom = str; // so no heap allocation when ROM is actually backed by whole string object - ReferenceEquals(rom.ToString(), str).ShouldBeTrue(); - //ReferenceEquals((string)rom, str).ShouldBeTrue(); + //ReferenceEquals(rom.ToString(), str).ShouldBeTrue(); + ReferenceEquals((string)rom, str).ShouldBeTrue(); } [Fact(Skip = "Known issue with ROM - it cannot represent null values")] From 9821b08cee0830b2c6693d76ab208126da2622f5 Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Thu, 12 Oct 2023 16:14:36 +0300 Subject: [PATCH 9/9] fix --- src/GraphQLParser.Tests/GraphQLParser.Tests.csproj | 5 ++--- src/GraphQLParser.Tests/MemoryTests.cs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj index 0a4f7334..9e1ffaa2 100644 --- a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj +++ b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj @@ -13,7 +13,8 @@ - netcoreapp3.1;net6;net7;net462 + netcoreapp3.1;net6;net7 + $(TargetFrameworks);net462 @@ -29,8 +30,6 @@ - - diff --git a/src/GraphQLParser.Tests/MemoryTests.cs b/src/GraphQLParser.Tests/MemoryTests.cs index 5d5c4aeb..de577618 100644 --- a/src/GraphQLParser.Tests/MemoryTests.cs +++ b/src/GraphQLParser.Tests/MemoryTests.cs @@ -150,7 +150,7 @@ public void Casted_To_String_From_Original_String_Should_Be_Equal(string str) ROM rom = str; // so no heap allocation when ROM is actually backed by whole string object - //ReferenceEquals(rom.ToString(), str).ShouldBeTrue(); + ReferenceEquals(rom.ToString(), str).ShouldBeTrue(); ReferenceEquals((string)rom, str).ShouldBeTrue(); }