From 6e30839be1a36468c332fe894cb551791edcbdff Mon Sep 17 00:00:00 2001 From: webwarrior Date: Tue, 5 Dec 2023 14:33:43 +0100 Subject: [PATCH] Core.Tests: added test for fix Added a test for suggested fix. --- .../Rules/Conventions/SuggestUseAutoProperty.fs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/FSharpLint.Core.Tests/Rules/Conventions/SuggestUseAutoProperty.fs b/tests/FSharpLint.Core.Tests/Rules/Conventions/SuggestUseAutoProperty.fs index dcb4c9bce..353777287 100644 --- a/tests/FSharpLint.Core.Tests/Rules/Conventions/SuggestUseAutoProperty.fs +++ b/tests/FSharpLint.Core.Tests/Rules/Conventions/SuggestUseAutoProperty.fs @@ -72,3 +72,18 @@ type Foo() = """ Assert.IsTrue(this.NoErrorsExist) + + [] + member this.``Quick fix for property that only returns immutable value`` () = + let source = """ +type Foo(content: int) = + member self.Content = content +""" + + let expected = """ +type Foo(content: int) = + member val Content = content +""" + + this.Parse source + Assert.AreEqual(expected, this.ApplyQuickFix source)