diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Basic.fs index 6593b8b32bd0..590e707751df 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/Events/Basic/Basic.fs @@ -80,21 +80,15 @@ module Events = |> verifyCompileAndRun |> shouldSucceed - // NoMT SOURCE=SanityCheck02.fs # SanityCheck02.fs - [] - let ``SanityCheck02_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - // SOURCE=SanityCheck02.fs PEVER=/MD # SanityCheck02.fs - /MD [] - let ``SanityCheck02_fs_peverify`` compilation = + let ``SanityCheck02`` compilation = compilation |> asExe |> withOptions ["--nowarn:988"] - |> verifyPEFileWithSystemDlls + |> verifyCompileAndRun |> shouldSucceed + |> verifyPEFileWithSystemDlls |> withOutputContainsAllInOrderWithWildcards [ "All Classes and Methods in*SanityCheck02.exe Verified." ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs index fd9eb1848d4a..981b2e5d95ab 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs @@ -34,6 +34,7 @@ module MyModule = printfn "Hello from main method" 0 """ + |> withName "SimpleTypesInNamespace" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -42,6 +43,11 @@ module MyModule = "Hello, World from MyLibrary.MySecondType" "Hello from main method" ] + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*SimpleTypesInNamespace.exe Verified." + ] + [] // RealSig @@ -60,6 +66,7 @@ type MySecondType = printfn "Hello from implicit main method" """ + |> withName "SimpleTypesInImplicitMain" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed @@ -68,6 +75,10 @@ printfn "Hello from implicit main method" "Hello, World from MyProgram.MySecondType" "Hello from implicit main method" ] + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*SimpleTypesInImplicitMain.exe Verified." + ] [] // RealSig @@ -91,6 +102,7 @@ module MyModule = printfn "Hello from main method" 0 """ + |> withName "SimpleTypeOneAndTypeTwoInNamespace" |> withRealInternalSignature realSig |> compileExeAndRun |> withStdOutContainsAllInOrder [ @@ -99,6 +111,10 @@ module MyModule = "Hello from main method" ] |> shouldSucceed + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*SimpleTypeOneAndTypeTwoInNamespace.exe Verified." + ] [] // RealSig [] // Regular @@ -130,12 +146,17 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ + |> withName "PublicTypePublicCtor" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed |> withStdOutContainsAllInOrder [ "Main program" ] + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypePublicCtor.exe Verified." + ] [] // RealSig @@ -168,12 +189,17 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ + |> withName "PublicTypeInternalCtor" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed |> withStdOutContainsAllInOrder [ "Main program" ] + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeInternalCtor.exe Verified." + ] [] // RealSig @@ -206,12 +232,17 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ + |> withName "PublicTypePrivateCtor" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed |> withStdOutContainsAllInOrder [ "Main program" ] + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypePrivateCtor.exe Verified." + ] [] // RealSig [] // Regular @@ -243,12 +274,17 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ + |> withName "PublicTypeUnspecifiedCtor" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed |> withStdOutContainsAllInOrder [ "Main program" ] + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeUnspecifiedCtor.exe Verified." + ] [] // RealSig [] // Regular @@ -280,13 +316,17 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ + |> withName "PrivateTypePublicCtor" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed |> withStdOutContainsAllInOrder [ "Main program" ] - + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypePublicCtor.exe Verified." + ] [] // RealSig [] // Regular @@ -318,12 +358,17 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ + |> withName "PrivateTypeInternalCtor" |> withRealInternalSignature realSig |> compileExeAndRun |> withStdOutContainsAllInOrder [ "Main program" ] |> shouldSucceed + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeInternalCtor.exe Verified." + ] [] // RealSig [] // Regular @@ -362,12 +407,17 @@ type FSharpSource with module doit = printfn "Main program" """ + |> withName "PrivateTypePrivateCtor" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed |> withStdOutContainsAllInOrder [ "Main program" ] + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypePrivateCtor.exe Verified." + ] [] // RealSig [] // Regular @@ -399,12 +449,17 @@ module doit = FSharpSource.CreateFromFile("Hello") |> ignore printfn "Main program" """ + |> withName "PrivateTypeUnspecifiedCtor" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed |> withStdOutContainsAllInOrder [ "Main program" ] + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeUnspecifiedCtor.exe Verified." + ] [] // RealSig [] // Regular @@ -439,12 +494,17 @@ let message = FSharpSourceFromFile.SetIt ("Here is something") printfn $"{message}" """ + |> withName "StaticInitializationNoInlinePrivateField" |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed |> withStdOutContainsAllInOrder [ "Here is something" ] + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*StaticInitializationNoInlinePrivateField.exe Verified." + ] [] // RealSig [] // Regular @@ -476,6 +536,7 @@ type MyClass = printfn "%A" (MyClass.result()) """ + |> withName "ComputationExpressionAccessPrivateBinding" |> withRealInternalSignature realSig |> withNoOptimize |> compileExeAndRun @@ -483,7 +544,10 @@ printfn "%A" (MyClass.result()) |> withStdOutContainsAllInOrder [ "Some 3" ] - + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*ComputationExpressionAccessPrivateBinding.exe Verified." + ] [] // RealSig Optimize [] // RealSig NoOptimize @@ -495,11 +559,16 @@ printfn "%A" (MyClass.result()) let source = File.ReadAllText (path) FSharp source + |> withName "NestedGenericClosure" |> asExe |> withRealInternalSignature realSig |> withOptimization optimize |> compileAndRun |> shouldSucceed + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*NestedGenericClosure.exe Verified." + ] [] // RealSig Optimize [] // RealSig NoOptimize @@ -538,11 +607,16 @@ module doIt = for i in enumerator.MoveNext() do printfn "%A" i """ + |> withName "GenericClassWithClosureWithConstraints" |> asExe |> withRealInternalSignature realSig |> withOptimization optimize |> compileAndRun |> shouldSucceed + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*GenericClassWithClosureWithConstraints.exe Verified." + ] [] // RealSig Optimize [] // RealSig NoOptimize @@ -700,11 +774,16 @@ type internal AgedLookup<'Token, 'Key, 'Value when 'Value: not struct>(keepStron let keep = FilterAndHold(tok) AssignWithStrength(tok, keep) """ + |> withName "AgedLookup" |> asLibrary |> withRealInternalSignature realSig |> withOptimization optimize |> compile |> shouldSucceed + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*AgedLookup.dll Verified." + ] [] // RealSig Optimize [] // RealSig NoOptimize @@ -718,11 +797,16 @@ namespace Equality type BigGenericTuple<'a> = BigGenericTuple of int * 'a * byte * int * 'a * byte """ + |> withName "BigTuples" |> asLibrary |> withRealInternalSignature realSig |> withOptimization optimize |> compile |> shouldSucceed + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*BigTuples.dll Verified." + ] [] // RealSig Optimize [] // RealSig NoOptimize @@ -735,14 +819,18 @@ type BigGenericTuple<'a> = BigGenericTuple of int * 'a * byte * int * 'a * byte module GroupByTest let ``for _ in Array groupBy id [||] do ...`` () = [|for _ in Array.groupBy id [||] do 0|] """ + |> withName "ArrayGroupById" |> asLibrary |> withRealInternalSignature realSig |> withOptimization optimize |> compile |> shouldSucceed + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*ArrayGroupById.dll Verified." + ] - - let roundTripWithInterfaceGeneration(realsig, optimize, implementationFile) = + let roundTripWithInterfaceGeneration(realsig, optimize, implementationFile, name) = let generatedSignature = Fs implementationFile @@ -751,6 +839,7 @@ let ``for _ in Array groupBy id [||] do ...`` () = [|for _ in Array.groupBy id [ |> printSignatures Fsi generatedSignature + |> withName name |> asLibrary |> withAdditionalSourceFile (FsSource implementationFile) |> withRealInternalSignature realsig @@ -774,7 +863,11 @@ type IMonad<'a> = abstract bind : #IMonad<'a> -> ('a -> #IMonad<'b>) -> IMonad<'b> end""" - roundTripWithInterfaceGeneration(realsig, optimize, implementationFile) + roundTripWithInterfaceGeneration(realsig, optimize, implementationFile, "GenericParameterOrderRoundtrip") + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*GenericParameterOrderRoundtrip.dll Verified." + ] [] // RealSig Optimize [] // RealSig NoOptimize @@ -803,4 +896,8 @@ namespace GenericInterfaceTest new(x) = { store = x } end""" - roundTripWithInterfaceGeneration(realsig, optimize, implementationFile) + roundTripWithInterfaceGeneration(realsig, optimize, implementationFile, "MembersBasicRoundtrip") + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*MembersBasicRoundtrip.dll Verified." + ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRoot.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRoot.fs index 763bbc9c33eb..a7ba195e02fc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRoot.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityModuleRoot.fs @@ -24,9 +24,14 @@ type public TypeTwo internal () = class end type public TypeThree private () = class end type public TypeFour () = class end """ + |> withName "PublicTypeConstructors" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeConstructors.dll Verified." + ] |> withILContains [ if realSig then """ .class auto ansi serializable nested public TypeOne @@ -91,9 +96,14 @@ type private TypeOne public () = class end type private TypeTwo internal () = class end type private TypeThree private () = class end type private TypeFour () = class end""" + |> withName "PrivateTypeConstructors" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeConstructors.dll Verified." + ] |> withILContains [ if realSig then """ @@ -254,9 +264,14 @@ type public TestType () = member private _.PrivateMethod() = () member _.DefaultMethod() = () """ + |> withName "PublicTypeInstanceMethods" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeInstanceMethods.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig instance void PublicMethod() cil managed" @@ -285,9 +300,14 @@ type public TestType () = member private _.PrivateMethod() = () member _.DefaultMethod() = () """ + |> withName "PrivateTypeInstanceMethods" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeInstanceMethods.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig instance void PublicMethod() cil managed" @@ -317,9 +337,14 @@ type public TestType () = member val private PrivateProperty = 0 with get, set member val DefaultProperty = 0 with get, set """ + |> withName "PublicTypeInstanceProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeInstanceProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig specialname instance int32 get_PublicProperty() cil managed" @@ -357,9 +382,14 @@ type public TestType () = member val private PrivateProperty = 0 with get, set member val DefaultProperty = 0 with get, set """ + |> withName "PrivateTypeInstanceMixedProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeInstanceMixedProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig specialname instance int32 get_PublicProperty() cil managed" @@ -405,9 +435,14 @@ type public TestType () = member _.MixedPropertyEleven with internal get() = 0 and set (_:int) = () member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ + |> withName "PublicTypeInstanceMixedProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeInstanceMixedProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig specialname instance int32 get_MixedPropertyOne() cil managed" @@ -460,7 +495,6 @@ type public TestType () = ".method public hidebysig specialname instance void set_MixedPropertyEleven(int32 _arg11) cil managed" ".method assembly hidebysig specialname instance int32 get_MixedPropertyTwelve() cil managed" ".method public hidebysig specialname instance void set_MixedPropertyTwelve(int32 _arg12) cil managed" - ] |> shouldSucceed @@ -485,9 +519,14 @@ type private TestType () = member _.MixedPropertyEleven with internal get() = 0 and set (_:int) = () member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ + |> withName "PrivateTypeInstanceMixedProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeInstanceMixedProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig specialname instance int32 get_MixedPropertyOne() cil managed" @@ -557,9 +596,14 @@ type public TestType () = static member private PrivateMethod() = () static member DefaultMethod() = () """ + |> withName "PublicTypeStaticMethods" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeStaticMethods.dll Verified." + ] |> withILContains [ if realSig then ".method public static void PublicMethod() cil managed" @@ -589,16 +633,20 @@ type private TestType () = static member private PrivateMethod() = () static member DefaultMethod() = () """ + |> withName "PrivateTypeStaticMethods" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeStaticMethods.dll Verified." + ] |> withILContains [ if realSig then ".method public static void PublicMethod() cil managed" ".method assembly static void InternalMethod() cil managed" ".method private static void PrivateMethod() cil managed" ".method public static void DefaultMethod() cil managed" - else ".method assembly static void PublicMethod() cil managed" ".method assembly static void InternalMethod() cil managed" @@ -620,9 +668,14 @@ type public TestType () = static member val internal InternalProperty = 0 with get, set static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" + |> withName "PublicTypeStaticProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeStaticProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public specialname static int32 get_PublicProperty() cil managed" @@ -658,9 +711,14 @@ type private TestType () = static member val internal InternalProperty = 0 with get, set static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" + |> withName "PrivateTypeStaticProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeStaticProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public specialname static int32 get_PublicProperty() cil managed" @@ -705,9 +763,14 @@ type public TestType () = static member MixedPropertyEleven with internal get() = 0 and set (_:int) = () static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ + |> withName "PublicTypeStaticMixedProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeStaticMixedProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public specialname static int32 get_MixedPropertyOne() cil managed" @@ -785,9 +848,14 @@ type private TestType () = static member MixedPropertyEleven with internal get() = 0 and set (_:int) = () static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ + |> withName "PrivateTypeStaticMixedProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeStaticMixedProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public specialname static int32 get_MixedPropertyOne() cil managed" @@ -844,12 +912,12 @@ type private TestType () = ] |> shouldSucceed - [] // RealSig - [] // Regular + [] // RealSig + [] // Regular [] // RealSig [] // Regular - [] // RealSig - [] // Regular + [] // RealSig + [] // Regular [] let ``lazy operation - member with various visibilities`` (realSig, scope) = FSharp $""" @@ -858,8 +926,13 @@ module internal SR = let getLazyThing () = lazyThing.Force() SR.getLazyThing () """ + |> withName "LazyOperationMemberWithVariousVisibilities" |> asExe |> withOptimize |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*LazyOperationMemberWithVariousVisibilities.exe Verified." + ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs index 695d6cd8ba23..bfddf645779d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibilityNamespaceRoot.fs @@ -24,9 +24,14 @@ type public TypeTwo internal () = class end type public TypeThree private () = class end type public TypeFour () = class end """ + |> withName "PublicTypeConstructors" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeConstructors.dll Verified." + ] |> withILContains [ if realSig then """ @@ -189,9 +194,14 @@ type private TypeTwo internal () = class end type private TypeThree private () = class end type private TypeFour () = class end """ + |> withName "PrivateTypeConstructors" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeConstructors.dll Verified." + ] |> withILContains [ """ .class private auto ansi serializable RealInternalSignature.TypeOne @@ -282,9 +292,14 @@ type public TestType () = member private _.PrivateMethod() = () member _.DefaultMethod() = () """ + |> withName "PublicTypeInstanceMethods" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeInstanceMethods.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig instance void PublicMethod() cil managed" @@ -313,9 +328,14 @@ type private TestType () = member private _.PrivateMethod() = () member _.DefaultMethod() = () """ + |> withName "PrivateTypeInstanceMethods" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeInstanceMethods.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig instance void PublicMethod() cil managed" @@ -345,9 +365,14 @@ type public TestType () = member val private PrivateProperty = 0 with get, set member val DefaultProperty = 0 with get, set """ + |> withName "PrivateTypeInstanceMethods" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeInstanceMethods.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig specialname instance int32 get_PublicProperty() cil managed" @@ -385,9 +410,14 @@ type public TestType () = member val private PrivateProperty = 0 with get, set member val DefaultProperty = 0 with get, set """ + |> withName "PrivateTypeInstanceProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeInstanceProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig specialname instance int32 get_PublicProperty() cil managed" @@ -433,9 +463,14 @@ type public TestType () = member _.MixedPropertyEleven with internal get() = 0 and set (_:int) = () member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ + |> withName "PublicTypeInstanceMixedProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeInstanceMixedProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public specialname rtspecialname instance void .ctor() cil managed" @@ -515,9 +550,14 @@ type private TestType () = member _.MixedPropertyEleven with internal get() = 0 and set (_:int) = () member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ + |> withName "PrivateTypeInstanceMixedProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeInstanceMixedProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public hidebysig specialname instance int32 get_MixedPropertyOne() cil managed" @@ -586,9 +626,14 @@ type public TestType () = static member private PrivateMethod() = () static member DefaultMethod() = () """ + |> withName "PublicTypeStaticMethods" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeStaticMethods.dll Verified." + ] |> withILContains [ if realSig then ".method public static void PublicMethod() cil managed" @@ -617,9 +662,14 @@ type public TestType () = static member private PrivateMethod() = () static member DefaultMethod() = () """ + |> withName "PrivateTypeStaticMethods" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeStaticMethods.dll Verified." + ] |> withILContains [ if realSig then ".method public static void PublicMethod() cil managed" @@ -648,9 +698,14 @@ type public TestType () = static member val internal InternalProperty = 0 with get, set static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" + |> withName "PublicTypeStaticProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeStaticProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public specialname static int32 get_PublicProperty() cil managed" @@ -687,9 +742,14 @@ type private TestType () = static member val internal InternalProperty = 0 with get, set static member val private PrivateProperty = 0 with get, set static member val DefaultProperty = 0 with get, set""" + |> withName "PrivateTypeStaticProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeStaticProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public specialname static int32 get_PublicProperty() cil managed" @@ -735,9 +795,14 @@ type public TestType () = static member MixedPropertyEleven with internal get() = 0 and set (_:int) = () static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ + |> withName "PublicTypeStatiMixedProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PublicTypeStatiMixedProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public specialname static int32 get_MixedPropertyOne() cil managed" @@ -815,9 +880,14 @@ type private TestType () = static member MixedPropertyEleven with internal get() = 0 and set (_:int) = () static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () """ + |> withName "PrivateTypeStatiMixedProperties" |> asLibrary |> withRealInternalSignature realSig |> compile + |> verifyPEFileWithSystemDlls + |> withOutputContainsAllInOrderWithWildcards [ + "All Classes and Methods in*PrivateTypeStatiMixedProperties.dll Verified." + ] |> withILContains [ if realSig then ".method public specialname static int32 get_MixedPropertyOne() cil managed" diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 400fa607ca51..1c9fca265927 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -204,6 +204,8 @@ module rec Compiler = with member this.Output = match this with Success o | Failure o -> o member this.RunOutput = this.Output.Output + member this.Compilation = this.Output.Compilation + member this.OutputPath = this.Output.OutputPath type ExecutionPlatform = | Anycpu = 0 diff --git a/tests/FSharp.Test.Utilities/ILVerifierModule.fs b/tests/FSharp.Test.Utilities/ILVerifierModule.fs index af9e8625a0c0..0329113f4ffb 100644 --- a/tests/FSharp.Test.Utilities/ILVerifierModule.fs +++ b/tests/FSharp.Test.Utilities/ILVerifierModule.fs @@ -35,32 +35,49 @@ module ILVerifierModule = | 0 -> {Outcome = NoExitCode; StdOut = outputText; StdErr = errorText } | _ -> {Outcome = ExitCode exitCode; StdOut = outputText; StdErr = errorText } - let private verifyPEFileAux cUnit args = + //let private verifyPEFileAux (compilationResult: CompilationResult) args = + // let result = + // match compilationResult.Compilation with + // | FS fs -> + // let result = compile compilationResult.Compilation, fs.OutputFileName + // match result with + // | CompilationResult.Success result, Some name -> + // let verifyResult = verifyPEFileCore args name + // match verifyResult.Outcome with + // | NoExitCode -> CompilationResult.Success {result with Output = Some (ExecutionOutput verifyResult)} + // | ExitCode _ -> CompilationResult.Failure {result with Output = Some (ExecutionOutput verifyResult)} + // | failed -> failwith $"Compilation must succeed in order to verify IL.{failed}" + + // | failed -> + // failwith $"""Compilation must succeed in order to verify IL.{failed}""" + // | _ -> + // failwith "PEVerify is only supported for F#." + // result + + let private verifyPEFileAux (compilationResult: CompilationResult) args = let result = - match cUnit with - | FS fs -> - let result = compile cUnit, fs.OutputFileName - match result with + match compilationResult.Compilation with + | FS _ -> + match compilationResult, compilationResult.OutputPath with | CompilationResult.Success result, Some name -> let verifyResult = verifyPEFileCore args name match verifyResult.Outcome with | NoExitCode -> CompilationResult.Success {result with Output = Some (ExecutionOutput verifyResult)} | ExitCode _ -> CompilationResult.Failure {result with Output = Some (ExecutionOutput verifyResult)} | failed -> failwith $"Compilation must succeed in order to verify IL.{failed}" - | failed -> failwith $"""Compilation must succeed in order to verify IL.{failed}""" | _ -> failwith "PEVerify is only supported for F#." result - let verifyPEFile cUnit = - verifyPEFileAux cUnit [||] + let verifyPEFile compilationResult = + verifyPEFileAux compilationResult [||] - let verifyPEFileWithArgs cUnit args = - verifyPEFileCore cUnit args + let verifyPEFileWithArgs compilationResult args = + verifyPEFileCore compilationResult args - let verifyPEFileWithSystemDlls cUnit = + let verifyPEFileWithSystemDlls compilationResult = // Get the path containing mecorlib.dll or System.Core.Private.dll let fsharpCorePath = typeof.Assembly.Location let systemPath = Path.GetDirectoryName(typeof.Assembly.Location) @@ -68,4 +85,4 @@ module ILVerifierModule = DirectoryInfo(systemPath).GetFiles("*.dll") |> Array.map (fun dll -> $"--reference \"{Path.Combine(systemPath, dll.FullName)}\"") |> Array.toList - verifyPEFileAux cUnit ($"--reference \"{fsharpCorePath}\"" :: systemDllPaths) + verifyPEFileAux compilationResult ($"--reference \"{fsharpCorePath}\"" :: systemDllPaths)