Skip to content

Commit 65fcc82

Browse files
author
Matt Mcveigh
committed
Add regression test for deeper issue
1 parent b49774b commit 65fcc82

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

tests/FSharpLint.Console.Tests/TestApp.fs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ type TestConsoleApplication() =
108108

109109
// Check default config triggers the hint we're expecting to ignore later.
110110
Assert.AreEqual(-1, returnCode)
111-
Assert.AreEqual(Set.ofList [
112-
"`List.map f (List.map g x)` might be able to be refactored into `List.map (g >> f) x`."], errors)
111+
Assert.AreEqual(Set.ofList ["`List.map f (List.map g x)` might be able to be refactored into `List.map (g >> f) x`."], errors)
113112

114113
let config = """
115114
{
@@ -127,3 +126,27 @@ type TestConsoleApplication() =
127126

128127
Assert.AreEqual(0, returnCode)
129128
Assert.AreEqual(Set.empty, errors)
129+
130+
/// Regression for bug discovered during: https://github.com/fsprojects/FSharpLint/issues/466
131+
/// Adding a rule to the config was disabling other rules unless they're explicitly specified.
132+
[<Test>]
133+
member __.``Adding a rule to a custom config should not have side effects on other rules (from the default config).``() =
134+
let config = """
135+
{
136+
exceptionNames: {
137+
enabled: false
138+
}
139+
}
140+
"""
141+
use config = new TemporaryFile(config, "json")
142+
143+
let input = """
144+
type Signature =
145+
abstract member Encoded : string
146+
abstract member PathName : string
147+
"""
148+
149+
let (returnCode, errors) = main [| "lint"; "--lint-config"; config.FileName; input |]
150+
151+
Assert.AreEqual(-1, returnCode)
152+
Assert.AreEqual(Set.ofList ["Consider changing `Signature` to be prefixed with `I`."], errors)

0 commit comments

Comments
 (0)