From aa52b411c0c0440ce3b6f6b633e46206b492a7e8 Mon Sep 17 00:00:00 2001 From: Robert Pickering Date: Thu, 22 Oct 2015 12:21:05 +0200 Subject: [PATCH] Repo for bug that affects FAKE --- tests/service/BugRepos.fs | 58 +++++++++++++++++++ .../FSharp.Compiler.Service.Tests.fsproj | 1 + 2 files changed, 59 insertions(+) create mode 100644 tests/service/BugRepos.fs diff --git a/tests/service/BugRepos.fs b/tests/service/BugRepos.fs new file mode 100644 index 0000000000..d4690be913 --- /dev/null +++ b/tests/service/BugRepos.fs @@ -0,0 +1,58 @@ +#if INTERACTIVE +#r "../../bin/v4.5/FSharp.Compiler.Service.dll" +#r "../../packages/NUnit/lib/nunit.framework.dll" +#load "FsUnit.fs" +#load "Common.fs" +#else +module FSharp.Compiler.Service.Tests.RugRepos +#endif + + +open Microsoft.FSharp.Compiler +open Microsoft.FSharp.Compiler.Interactive.Shell +open Microsoft.FSharp.Compiler.SourceCodeServices + +open NUnit.Framework +open FsUnit +open System +open System.IO +open System.Text + +// Intialize output and input streams +let inStream = new StringReader("") +let outStream = new CompilerOutputStream() +let errStream = new CompilerOutputStream() + +// Build command line arguments & start FSI session +let argv = [| "C:\\fsi.exe" |] +let allArgs = Array.append argv [|"--noninteractive"|] + +let fsiConfig = FsiEvaluationSession.GetDefaultConfiguration(fsi) +let fsiSession = FsiEvaluationSession.Create(fsiConfig, allArgs, inStream, new StreamWriter(outStream), new StreamWriter(errStream)) + +/// Evaluate interaction & ignore the result +let evalInteraction text = + fsiSession.EvalInteraction(text) + +[] +let ``FAKE #985 - works``() = + let script = " + +let configure () = + let dlls = seq { yield \"\" } + let tabName = \"\" //new System.String([||]) // sprintf \"%s\" \"\" + for _ in dlls do + System.Console.WriteLine(tabName)" + evalInteraction script + +[] +let ``FAKE #985 - fails``() = + let script = " + +let configure () = + let dlls = seq { yield \"\" } + let tabName = new System.String([||]) + for _ in dlls do + System.Console.WriteLine(tabName)" + evalInteraction script + diff --git a/tests/service/FSharp.Compiler.Service.Tests.fsproj b/tests/service/FSharp.Compiler.Service.Tests.fsproj index dfbed86909..59fa094c5c 100644 --- a/tests/service/FSharp.Compiler.Service.Tests.fsproj +++ b/tests/service/FSharp.Compiler.Service.Tests.fsproj @@ -64,6 +64,7 @@ +