-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Fixie to latest version. Separate integration tests into their…
… own assembly. Integration tests use a custom convention, in which new test cases can be added simply by dropping a *.rook and *.rook.out file into the project.
- Loading branch information
Showing
40 changed files
with
257 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using Fixie; | ||
using Fixie.Conventions; | ||
|
||
namespace Rook.IntegrationTest | ||
{ | ||
public class IntegrationTestConvention : Convention | ||
{ | ||
public IntegrationTestConvention() | ||
{ | ||
Classes | ||
.Where(type => type == typeof(IntegrationTests)); | ||
|
||
Methods | ||
.Where(method => method.IsVoid()); | ||
|
||
Parameters(method => Directory.GetFiles(Directory.GetCurrentDirectory()) | ||
.Where(file => file.EndsWith(".rook")) | ||
.Select(Path.GetFileName) | ||
.Select(file => file.Substring(0, file.Length - ".rook".Length)) | ||
.Select(file => new object[] {file})); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using Fixie; | ||
using Rook.Compiling; | ||
using Should; | ||
|
||
namespace Rook.IntegrationTest | ||
{ | ||
public class IntegrationTests | ||
{ | ||
public void ProgramShouldHaveExpectedOutput(string programName) | ||
{ | ||
var expectedOutput = File.ReadAllText(programName + ".rook.out"); | ||
var actualOutput = Execute(Build(File.ReadAllText(programName + ".rook"))).ToString(); | ||
|
||
actualOutput.ShouldEqual(expectedOutput); | ||
} | ||
|
||
private static Assembly Build(string rookCode) | ||
{ | ||
var result = new RookCompiler(CompilerParameters.ForBasicEvaluation()).Build(rookCode); | ||
|
||
if (result.Errors.Any()) | ||
Fail.WithErrors(result.Errors); | ||
|
||
return result.CompiledAssembly; | ||
} | ||
|
||
private static object Execute(Assembly assembly) | ||
{ | ||
using (var console = new RedirectedConsole()) | ||
{ | ||
var result = assembly.Execute(); | ||
|
||
var writerResult = console.Output; | ||
|
||
if ((result == null || result == Core.Void.Value) && writerResult != "") | ||
return writerResult; | ||
|
||
return result; | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
using System.Reflection; | ||
[assembly: AssemblyTitle("Rook.IntegrationTest")] |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{A593DA5E-1ADE-4CDC-85B5-C1F8B39C082B}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Rook.IntegrationTest</RootNamespace> | ||
<AssemblyName>Rook.IntegrationTest</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> | ||
<RestorePackages>true</RestorePackages> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Fixie"> | ||
<HintPath>..\packages\Fixie.0.0.1.144\lib\net45\Fixie.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Should"> | ||
<HintPath>..\packages\Should.1.1.20\lib\Should.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="..\CommonAssemblyInfo.cs"> | ||
<Link>Properties\CommonAssemblyInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="IntegrationTestConvention.cs" /> | ||
<Compile Include="IntegrationTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
<None Include="ArithmeticExpression.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="ArithmeticExpression.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="BlockExpression.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="BlockExpression.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="BooleanExpression.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="BooleanExpression.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Classes.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Classes.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Closure.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Closure.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Enumerable.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Enumerable.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="FunctionCall.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="FunctionCall.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="IndexerOverloading.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="IndexerOverloading.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="MethodInvocation.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="MethodInvocation.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="MutualRecursion.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="MutualRecursion.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Nullable.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Nullable.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Recursion.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Recursion.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="String.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="String.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Vector.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Vector.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Void.rook"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Void.rook.out"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Rook.Compiling\Rook.Compiling.csproj"> | ||
<Project>{DD4E13B5-E96D-4DBF-9821-9908839ECDD4}</Project> | ||
<Name>Rook.Compiling</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Rook.Core\Rook.Core.csproj"> | ||
<Project>{646BF299-17FE-4B59-BC83-5D28AF7D5A48}</Project> | ||
<Name>Rook.Core</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Rook.Test\Rook.Test.csproj"> | ||
<Project>{1F93496B-9601-4EA7-86A7-B1615E5847A9}</Project> | ||
<Name>Rook.Test</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Fixie" version="0.0.1.144" targetFramework="net45" /> | ||
<package id="Should" version="1.1.20" targetFramework="net45" /> | ||
</packages> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.