From feb61fd4e132fa38fccb63ef16375a5c0e9228da Mon Sep 17 00:00:00 2001 From: nojaf Date: Fri, 14 Jan 2022 17:19:20 +0100 Subject: [PATCH] Add regression test for type definition in signature file wrapped with hash directives. Fixes #1115. --- src/Fantomas.Tests/CompilerDirectivesTests.fs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Fantomas.Tests/CompilerDirectivesTests.fs b/src/Fantomas.Tests/CompilerDirectivesTests.fs index 6225e23ec7..aab914728f 100644 --- a/src/Fantomas.Tests/CompilerDirectivesTests.fs +++ b/src/Fantomas.Tests/CompilerDirectivesTests.fs @@ -2704,3 +2704,31 @@ let x = 1 let x = 1 #endif """ + +[] +let ``type definition in signature file wrapped with hash directives, 1115`` () = + formatSourceString + true + """ +namespace X + +type UnresolvedAssemblyReference = UnresolvedAssemblyReference of string * AssemblyReference list + +#if !NO_EXTENSIONTYPING +type ResolvedExtensionReference = ResolvedExtensionReference of string * AssemblyReference list * Tainted list +#endif +""" + config + |> prepend newline + |> should + equal + """ +namespace X + +type UnresolvedAssemblyReference = UnresolvedAssemblyReference of string * AssemblyReference list + +#if !NO_EXTENSIONTYPING +type ResolvedExtensionReference = + | ResolvedExtensionReference of string * AssemblyReference list * Tainted list +#endif +"""