From a64c77f7e0da33520c032e5a10a5a25ac6f355fc Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 1 Jul 2019 17:42:05 -0700 Subject: [PATCH] Update tests --- .../UseIndexOperatorTests.cs | 2 ++ .../UseRangeOperatorTests.cs | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/UseIndexOrRangeOperator/UseIndexOperatorTests.cs b/src/EditorFeatures/CSharpTest/UseIndexOrRangeOperator/UseIndexOperatorTests.cs index 394bc936436..c8bdb0b06e5 100644 --- a/src/EditorFeatures/CSharpTest/UseIndexOrRangeOperator/UseIndexOperatorTests.cs +++ b/src/EditorFeatures/CSharpTest/UseIndexOrRangeOperator/UseIndexOperatorTests.cs @@ -7,6 +7,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; +using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseIndexOrRangeOperator @@ -334,6 +335,7 @@ void Goo(S s) }", parameters: s_testParameters); } + [WorkItem(36909, "https://github.com/dotnet/roslyn/issues/36909")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIndexOperator)] public async Task TestMissingWithNoSystemIndex() { diff --git a/src/EditorFeatures/CSharpTest/UseIndexOrRangeOperator/UseRangeOperatorTests.cs b/src/EditorFeatures/CSharpTest/UseIndexOrRangeOperator/UseRangeOperatorTests.cs index 3532086e795..aac653b7e57 100644 --- a/src/EditorFeatures/CSharpTest/UseIndexOrRangeOperator/UseRangeOperatorTests.cs +++ b/src/EditorFeatures/CSharpTest/UseIndexOrRangeOperator/UseRangeOperatorTests.cs @@ -7,6 +7,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; +using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseIndexOrRangeOperator @@ -58,11 +59,27 @@ void Goo(string s) "); } + [WorkItem(36909, "https://github.com/dotnet/roslyn/issues/36909")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseRangeOperator)] + public async Task TestNotWithoutSystemRange() + { + await TestMissingInRegularAndScriptAsync( +@" +class C +{ + void Goo(string s) + { + var v = s.Substring([||]1, s.Length - 1); + } +}", new TestParameters(parseOptions: s_parseOptions)); + } + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseRangeOperator)] public async Task TestSimple() { await TestAsync( @" +namespace System { public struct Range { } } class C { void Goo(string s) @@ -71,6 +88,7 @@ void Goo(string s) } }", @" +namespace System { public struct Range { } } class C { void Goo(string s) @@ -85,6 +103,7 @@ public async Task TestComplexSubstraction() { await TestAsync( @" +namespace System { public struct Range { } } class C { void Goo(string s, int bar, int baz) @@ -93,6 +112,7 @@ void Goo(string s, int bar, int baz) } }", @" +namespace System { public struct Range { } } class C { void Goo(string s, int bar, int baz) @@ -107,6 +127,7 @@ public async Task TestConstantSubtraction1() { await TestAsync( @" +namespace System { public struct Range { } } class C { void Goo(string s) @@ -115,6 +136,7 @@ void Goo(string s) } }", @" +namespace System { public struct Range { } } class C { void Goo(string s) @@ -183,6 +205,7 @@ public async Task TestFixAllInvocationToElementAccess1() // simplify even further. await TestAsync( @" +namespace System { public struct Range { } } class C { void Goo(string s, string t) @@ -191,6 +214,7 @@ void Goo(string s, string t) } }", @" +namespace System { public struct Range { } } class C { void Goo(string s, string t) -- GitLab