From c9fa55eb3814468110a714e57e8c183d8347edaf Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Sat, 17 Jun 2017 01:22:53 +0200 Subject: [PATCH 1/2] 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 7d441559f7056190283e06e3409929fced92d8c1 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Sat, 17 Jun 2017 02:26:32 +0200 Subject: [PATCH 2/2] 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)