From 8e0cc947befa9ccdf1a32f38fbacb7b3b2a3b618 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Sat, 17 Jun 2017 01:22:53 +0200 Subject: [PATCH 1/3] Add F# EndToEnd tests An app with lib --- test/EndToEnd/GivenFSharpShouldWork.cs | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 test/EndToEnd/GivenFSharpShouldWork.cs diff --git a/test/EndToEnd/GivenFSharpShouldWork.cs b/test/EndToEnd/GivenFSharpShouldWork.cs new file mode 100644 index 0000000000..c4c98522ce --- /dev/null +++ b/test/EndToEnd/GivenFSharpShouldWork.cs @@ -0,0 +1,70 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.IO; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace Microsoft.DotNet.Tests.EndToEnd +{ + public class GivenFSharpShouldWork : TestBase + { + [Fact] + public void AppWithLib() + { + using (DisposableDirectory directory = Temp.CreateDirectory()) + { + string projectDirectory = directory.Path; + + string newArgsLib = "lib -n lib -lang f# -f netcoreapp2.0 --debug:ephemeral-hive --no-restore"; + new NewCommandShim() + .WithWorkingDirectory(projectDirectory) + .Execute(newArgsLib) + .Should().Pass(); + + File.WriteAllText(Path.Combine(projectDirectory, "lib", "Library.fs"), @" +namespace Lib +module Say = + let hello name = printfn ""Hello World from %s by library!"" name + "); + + string newArgsApp = "console -n app -lang f# -f netcoreapp2.0 --debug:ephemeral-hive --no-restore"; + new NewCommandShim() + .WithWorkingDirectory(projectDirectory) + .Execute(newArgsApp) + .Should().Pass(); + + File.WriteAllText(Path.Combine(projectDirectory, "app", "Program.fs"), @" +[] +let main argv = + Lib.Say.hello ""F#"" + 0 + "); + + new DotnetCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("add app reference lib/lib.fsproj") + .Should().Pass(); + + new RestoreCommand() + .WithWorkingDirectory(projectDirectory) + //.Execute("/p:SkipInvalidConfigurations=true") + .Execute("app") + .Should().Pass(); + + new BuildCommand() + .WithWorkingDirectory(projectDirectory) + .Execute("app") + .Should().Pass(); + + new RunCommand() + .WithWorkingDirectory(projectDirectory) + .ExecuteWithCapturedOutput("-p app") + .Should().Pass() + .And.HaveStdOutContaining("Hello World from F# by library!"); + } + } + + } +} From ac71ec0c95a48b262410847235c9eb0c991f0183 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Sat, 17 Jun 2017 02:26:32 +0200 Subject: [PATCH 2/3] fails if lib is `netstandard2.0` instead of `netcoreapp2.0` --- test/EndToEnd/GivenFSharpShouldWork.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/EndToEnd/GivenFSharpShouldWork.cs b/test/EndToEnd/GivenFSharpShouldWork.cs index c4c98522ce..ce3241fe49 100644 --- a/test/EndToEnd/GivenFSharpShouldWork.cs +++ b/test/EndToEnd/GivenFSharpShouldWork.cs @@ -17,7 +17,7 @@ public void AppWithLib() { string projectDirectory = directory.Path; - string newArgsLib = "lib -n lib -lang f# -f netcoreapp2.0 --debug:ephemeral-hive --no-restore"; + string newArgsLib = "lib -n lib -lang f# -f netstandard2.0 --debug:ephemeral-hive --no-restore"; new NewCommandShim() .WithWorkingDirectory(projectDirectory) .Execute(newArgsLib) From 4c62851db9a5648eed75e2f5783c5b7a129845fb Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Thu, 22 Jun 2017 00:34:57 +0200 Subject: [PATCH 3/3] run will implicit do restore+build --- test/EndToEnd/GivenFSharpShouldWork.cs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/test/EndToEnd/GivenFSharpShouldWork.cs b/test/EndToEnd/GivenFSharpShouldWork.cs index ce3241fe49..c8bc49a0fb 100644 --- a/test/EndToEnd/GivenFSharpShouldWork.cs +++ b/test/EndToEnd/GivenFSharpShouldWork.cs @@ -47,17 +47,6 @@ namespace Lib .Execute("add app reference lib/lib.fsproj") .Should().Pass(); - new RestoreCommand() - .WithWorkingDirectory(projectDirectory) - //.Execute("/p:SkipInvalidConfigurations=true") - .Execute("app") - .Should().Pass(); - - new BuildCommand() - .WithWorkingDirectory(projectDirectory) - .Execute("app") - .Should().Pass(); - new RunCommand() .WithWorkingDirectory(projectDirectory) .ExecuteWithCapturedOutput("-p app")