@@ -125,7 +125,7 @@ let ensureDefaultFSharpCoreAvailable tmpDir =
125125 File.Copy( fsCoreDefaultReference(), Path.Combine( tmpDir, Path.GetFileName( fsCoreDefaultReference())), overwrite = true )
126126#endif
127127
128- let compile isDll debugMode ( assemblyName : string ) ( ext : string ) ( code : string ) ( dependencies : string list ) =
128+ let compile isDll debugMode ( assemblyName : string ) ( ext : string ) ( code : string ) ( dependencies : string list ) ( extraArgs : string list ) =
129129 let tmp = Path.Combine( Path.GetTempPath(), " test" + string( hash ( isDll, debugMode, assemblyName, code, dependencies)))
130130 try Directory.CreateDirectory( tmp) |> ignore with _ -> ()
131131 let sourceFile = Path.Combine( tmp, assemblyName + " ." + ext)
@@ -156,7 +156,10 @@ let compile isDll debugMode (assemblyName : string) (ext: string) (code : string
156156
157157 yield sprintf " --out:%s " outFile
158158
159+ yield ! extraArgs
160+
159161 yield sourceFile
162+
160163 |]
161164
162165 ensureDefaultFSharpCoreAvailable tmp
@@ -172,7 +175,7 @@ let compile isDll debugMode (assemblyName : string) (ext: string) (code : string
172175//sizeof<nativeint>
173176let compileAndVerify isDll debugMode assemblyName ext code dependencies =
174177 let verifier = new PEVerifier ()
175- let outFile = compile isDll debugMode assemblyName ext code dependencies
178+ let outFile = compile isDll debugMode assemblyName ext code dependencies []
176179 verifier.Verify outFile
177180 outFile
178181
@@ -293,7 +296,8 @@ module Bar
293296
294297"""
295298 try
296- compile false PdbOnly " Bar" " fs" code [] |> ignore
299+ let outFile : string = compile false PdbOnly " Bar" " fs" code [] []
300+ ()
297301 with
298302 | :? CompilationError as exn ->
299303 Assert.AreEqual( 6 , exn.Data2.[ 0 ]. StartLineAlternate)
@@ -305,7 +309,8 @@ let ``Check cols are indexed by 1`` () =
305309 let code = " let x = 1 + a"
306310
307311 try
308- compile false PdbOnly " Foo" " fs" code [] |> ignore
312+ let outFile : string = compile false PdbOnly " Foo" " fs" code [] []
313+ ()
309314 with
310315 | :? CompilationError as exn ->
311316 Assert.True( exn.Data2.[ 0 ]. ToString() .Contains( " Foo.fs (1,13)-(1,14)" ))
@@ -320,7 +325,8 @@ let ``Check compile of bad fsx`` () =
320325 """
321326
322327 try
323- compile false PdbOnly " Foo" " fsx" code [] |> ignore
328+ let outFile : string = compile false PdbOnly " Foo" " fsx" code [] []
329+ ()
324330 with
325331 | :? CompilationError as exn ->
326332 Assert.True( exn.Data2.[ 0 ]. ToString() .Contains( " Could not load file '" ))
@@ -329,6 +335,21 @@ let ``Check compile of bad fsx`` () =
329335 | _ -> failwith " No compilation error"
330336
331337
338+ [<Test>]
339+ let ``Check compile of good fsx with bad option`` () =
340+ let code = """
341+ let x = 1
342+ """
343+
344+ try
345+ let outFile : string = compile false PdbOnly " Foo" " fsx" code [] [ " -r:missing.dll" ]
346+ ()
347+ with
348+ | :? CompilationError as exn ->
349+ Assert.True( exn.Data2.[ 0 ]. ToString() .Contains( " startup (1,1)-(1,81) parameter error Could not resolve this reference" ))
350+ | _ -> failwith " No compilation error"
351+
352+
332353#if STRESS
333354// For this stress test the aim is to check if we have a memory leak
334355
@@ -348,7 +369,8 @@ type C() =
348369let x = 3 + 4
349370"""
350371
351- compile true PdbOnly " Foo" code [] |> ignore
372+ let outFile : string = compile true PdbOnly " Foo" " fs" code [] []
373+ ()
352374
353375#endif
354376
0 commit comments