dotnet-installer/test/dotnet-compile-fsc.Tests/GivenThatIWantToCompileFSharpPrograms.cs

67 lines
2.2 KiB
C#
Raw Normal View History

Extract dotnet-compile-fsc into a standalone command Add basic Tests for dotnet-compile-fsc Package Targets execute before TestTargets. Use Generated Nuget Packages in TestTargets. Generate Nuget packages on all platforms, and in C# Fix bug in dotnet-restore, change fsharp new template, add support for native assets in DependencyContextCsvReader copy fsc.exe to temp directory instead of package cache fix rebase error fix issue fixes fixes fix temporarily disable debian package e2e testing fixes bump fsc version update fsc version fix rebase errors WIP update fsc tool WIP, rebased and working again, need to solve issues with System.CommandLine Working state for packaged, command, fsc.exe bugging out with dlopen(, 1): no suitable image found. execute fsc like a unpublished standalone app fixup after rebase working? internet is out working cleanup More cleanup, and run the debian package tests during the Test phase of the build. update FSharp Test Projects NetStandard Library Version Update Version Suffix when packing TestPackages. This will enable packing with the right dependency versions on Windows. update dotnet-test version Undo the reordering of the build fix test package project pathsj ignore net451 build failures for test packages which we need to build on non-windows update dependency of desktop test app add dotnetcli feed to nuget config for fsharp dotnet new update deps after rebase update dependency of dotnet-compile-fsc pass args before commandPath when using muxer for tools adjust testpackage cleaning not to clean packages which are also generated as part of the product from the nuget cache. undo Pass projectJson to pack instead of using WorkingDirectory fix path separators using depsjsoncommandresolver on windows, fix building only specific frameworks for testpackages on non-windows. PR Feedback rebase overwrite fsc runtimeconfig
2016-03-12 00:41:00 +00:00
// 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.Cli.Utils;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using FluentAssertions;
using Xunit;
namespace Microsoft.DotNet.Tools.Compiler.Tests
{
public class GivenThatIWantToCompileFSharpPrograms
{
private readonly static string s_testProjectsRoot = Path.Combine(
AppContext.BaseDirectory,
"TestAssets",
"TestProjects",
"FSharpTestProjects");
[Fact]
public void Compilation_of_app_with_invalid_source_should_fail()
{
var testProject = Path.Combine(s_testProjectsRoot, "CompileFailApp", "project.json");
var buildCommand = new BuildCommand(testProject);
var oldDirectory = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(Path.GetDirectoryName(testProject));
buildCommand.Execute().Should().Fail();
Directory.SetCurrentDirectory(oldDirectory);
}
[Fact]
public void Compilation_of_valid_app_should_succeed()
{
var testProject = Path.Combine(s_testProjectsRoot, "TestAppWithArgs", "project.json");
var buildCommand = new BuildCommand(testProject);
var oldDirectory = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(Path.GetDirectoryName(testProject));
buildCommand.Execute().Should().Pass();
Directory.SetCurrentDirectory(oldDirectory);
}
[Fact]
public void Compilation_of_app_with_P2P_reference_to_fsharp_library_should_be_runnable()
{
var testProject = Path.Combine(s_testProjectsRoot, "TestApp", "project.json");
var runCommand = new RunCommand(testProject);
var oldDirectory = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(Path.GetDirectoryName(testProject));
var result = runCommand.Execute();
result.Should().Pass();
Directory.SetCurrentDirectory(oldDirectory);
}
}
}