diff --git a/.dockerignore b/.dockerignore index d57c652..4d0ec75 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,13 +1,5 @@ * -!bin/run.sh -!bin/run-tests.sh -!src/Exercism.TestRunner.FSharp -src/Exercism.TestRunner.FSharp/bin -src/Exercism.TestRunner.FSharp/obj -.appends -.git -.github -.gitignore -.gitattributes -.dockerignore -Dockerfile +!/bin/run.sh +!/src/Exercism.TestRunner.FSharp +/src/Exercism.TestRunner.FSharp/bin +/src/Exercism.TestRunner.FSharp/obj diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ccc949d..235a66c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ on: jobs: build: name: Tests - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 diff --git a/Dockerfile b/Dockerfile index a7902b6..fc2d77f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,33 @@ -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0.103-alpine3.23 AS build ARG TARGETARCH WORKDIR /tmp # Pre-install packages for offline usage RUN dotnet new console -RUN dotnet add package Microsoft.NET.Test.Sdk -v 16.8.3 -RUN dotnet add package xunit -v 2.4.1 -RUN dotnet add package xunit.runner.visualstudio -v 2.4.3 -RUN dotnet add package FsUnit -v 4.0.4 -RUN dotnet add package FsUnit.xUnit -v 4.0.4 -RUN dotnet add package Exercism.Tests -v 0.1.0-alpha -RUN dotnet add package Exercism.Tests -v 0.1.0-beta1 -RUN dotnet add package Aether -v 8.3.1 -RUN dotnet add package BenchmarkDotNet -v 0.12.1 -RUN dotnet add package FakeItEasy -v 6.2.1 -RUN dotnet add package FsCheck -v 2.14.3 -RUN dotnet add package FsCheck -v 2.16.3 -RUN dotnet add package FsCheck.Xunit -v 2.14.3 -RUN dotnet add package FSharp.Core -v 6.0.1 -RUN dotnet add package FSharp.Core -v 7.0.400 -RUN dotnet add package FSharp.Core -v 8.0.101 -RUN dotnet add package FSharp.Core -v 8.0.403 -RUN dotnet add package FSharp.Core -v 9.0.201 -RUN dotnet add package FParsec -v 1.1.1 -RUN dotnet add package FsToolkit.ErrorHandling -v 4.15.2 +RUN dotnet add package Microsoft.NET.Test.Sdk --version 16.8.3 +RUN dotnet add package Microsoft.NET.Test.Sdk --version 18.3.0 +RUN dotnet add package xunit --version 2.4.1 +RUN dotnet add package xunit.v3 --version 3.2.2 +RUN dotnet add package xunit.runner.visualstudio --version 2.4.3 +RUN dotnet add package xunit.runner.visualstudio --version 3.1.5 +RUN dotnet add package FsUnit --version 4.0.4 +RUN dotnet add package FsUnit.xUnit --version 4.0.4 +RUN dotnet add package FsUnit.xUnit --version 7.1.1 +RUN dotnet add package Exercism.Tests --version 0.1.0-alpha +RUN dotnet add package Exercism.Tests --version 0.1.0-beta1 +RUN dotnet add package Exercism.Tests.xunit.v3 --version 0.1.0-beta1 +RUN dotnet add package Aether --version 8.3.1 +RUN dotnet add package BenchmarkDotNet --version 0.12.1 +RUN dotnet add package FakeItEasy --version 6.2.1 +RUN dotnet add package FsCheck --version 2.14.3 +RUN dotnet add package FsCheck --version 3.3.2 +RUN dotnet add package FsCheck.Xunit --version 2.14.3 +RUN dotnet add package FsCheck.Xunit.v3 --version 3.3.2 +RUN dotnet add package FSharp.Core --version 9.0.201 +RUN dotnet add package FSharp.Core --version 10.0.103 +RUN dotnet add package FParsec --version 1.1.1 +RUN dotnet add package FsToolkit.ErrorHandling --version 4.15.2 WORKDIR /app @@ -37,7 +40,7 @@ COPY src/Exercism.TestRunner.FSharp/ ./ RUN dotnet publish -a $TARGETARCH -c Release -o /opt/test-runner --no-restore # Build runtime image -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS runtime +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0.103-alpine3.23 AS runtime ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false ENV DOTNET_ROLL_FORWARD=Major @@ -48,6 +51,6 @@ WORKDIR /opt/test-runner COPY --from=build /root/.nuget/packages/ /root/.nuget/packages/ COPY --from=build /opt/test-runner/ . -COPY bin/ bin/ +COPY bin/run.sh bin/run.sh ENTRYPOINT ["sh", "/opt/test-runner/bin/run.sh"] diff --git a/Exercism.TestRunner.FSharp.sln b/Exercism.TestRunner.FSharp.sln deleted file mode 100644 index 83413c8..0000000 --- a/Exercism.TestRunner.FSharp.sln +++ /dev/null @@ -1,16 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Exercism.TestRunner.FSharp", "src\Exercism.TestRunner.FSharp\Exercism.TestRunner.FSharp.fsproj", "{716757E0-24F9-4228-8B0E-48010F51A370}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {716757E0-24F9-4228-8B0E-48010F51A370}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {716757E0-24F9-4228-8B0E-48010F51A370}.Debug|Any CPU.Build.0 = Debug|Any CPU - {716757E0-24F9-4228-8B0E-48010F51A370}.Release|Any CPU.ActiveCfg = Release|Any CPU - {716757E0-24F9-4228-8B0E-48010F51A370}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/Exercism.TestRunner.FSharp.slnx b/Exercism.TestRunner.FSharp.slnx new file mode 100644 index 0000000..a4055d4 --- /dev/null +++ b/Exercism.TestRunner.FSharp.slnx @@ -0,0 +1,3 @@ + + + diff --git a/README.md b/README.md index b7f6fe2..98694b1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repository contains the F# test runner, which implements the [test runner i To run a solution's tests, follow these steps: 1. Open a command prompt in the root directory. -1. Run `./run.ps1 `. This script will: +1. Run `./bin/run.sh `. This script will: 1. Make sure all tests run (no skipped tests) for the solution found in ``. 1. Run all the tests. 1. Once the script has completed, the test results will be written to `/results.json`. @@ -19,7 +19,7 @@ To run a solution's tests, follow these steps: To run a solution's tests using a Docker container, follow these steps: 1. Open a command prompt in the root directory. -1. Run `./run-in-docker.ps1 `. This script will: +1. Run `./bin/run-in-docker.sh `. This script will: 1. Make sure all tests run (no skipped tests) for the solution found in ``. 1. Run all the tests. 1. Once the script has completed, the test results will be written to `/results.json`. diff --git a/bin/run-in-docker.sh b/bin/run-in-docker.sh index a9f10be..6ec9bbd 100755 --- a/bin/run-in-docker.sh +++ b/bin/run-in-docker.sh @@ -37,7 +37,6 @@ docker build --rm -t exercism/fsharp-test-runner . docker run \ --rm \ --network none \ - --read-only \ --mount type=bind,src="${solution_dir}",dst=/solution \ --mount type=bind,src="${output_dir}",dst=/output \ --mount type=tmpfs,dst=/tmp \ diff --git a/bin/run-tests-in-docker.sh b/bin/run-tests-in-docker.sh index e050472..eef709b 100755 --- a/bin/run-tests-in-docker.sh +++ b/bin/run-tests-in-docker.sh @@ -20,8 +20,8 @@ docker build --rm -t exercism/fsharp-test-runner . docker run \ --rm \ --network none \ - --read-only \ --mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests \ + --mount type=bind,src="${PWD}/bin/run-tests.sh",dst=/opt/test-runner/bin/run-tests.sh \ --mount type=tmpfs,dst=/tmp \ --workdir /opt/test-runner \ --entrypoint /opt/test-runner/bin/run-tests.sh \ diff --git a/bin/update-golden-tests.sh b/bin/update-golden-tests.sh new file mode 100755 index 0000000..4e61031 --- /dev/null +++ b/bin/update-golden-tests.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +# Synopsis: +# Update the golden tests. + +# Example: +# ./bin/update-golden-tests.sh + +# Generate the up-to-date results.json +./bin/run-tests-in-docker.sh + +# Overwrite the existing files +find tests -name results.json -execdir cp results.json expected_results.json \; diff --git a/src/Exercism.TestRunner.FSharp/Exercism.TestRunner.FSharp.fsproj b/src/Exercism.TestRunner.FSharp/Exercism.TestRunner.FSharp.fsproj index 9533b48..2c17e5f 100644 --- a/src/Exercism.TestRunner.FSharp/Exercism.TestRunner.FSharp.fsproj +++ b/src/Exercism.TestRunner.FSharp/Exercism.TestRunner.FSharp.fsproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 @@ -20,10 +20,10 @@ - - - - + + + + diff --git a/src/Exercism.TestRunner.FSharp/Rewrite.fs b/src/Exercism.TestRunner.FSharp/Rewrite.fs index e9e2510..b52e266 100644 --- a/src/Exercism.TestRunner.FSharp/Rewrite.fs +++ b/src/Exercism.TestRunner.FSharp/Rewrite.fs @@ -71,12 +71,12 @@ let private enableAllTests parsedInput = let private rewriteProjectFile (context: TestRunContext) = let originalProjectFile = File.ReadAllText(context.ProjectFile) let rewrittenProjectFile = - originalProjectFile - .Replace("net5.0", "net9.0") - .Replace("net6.0", "net9.0") - .Replace("net7.0", "net9.0") - .Replace("net8.0", "net9.0") - originalProjectFile, rewrittenProjectFile + if originalProjectFile.Contains("") then + originalProjectFile.Replace("net9.0", "net10.0") + else + originalProjectFile.Replace("net9.0", "net10.0") + .Replace("", "Exercism\n ") + originalProjectFile, rewrittenProjectFile let rewriteTests (context: TestRunContext) = match parseFile context.TestsFile with diff --git a/src/Exercism.TestRunner.FSharp/Testing.fs b/src/Exercism.TestRunner.FSharp/Testing.fs index 91bc35a..e8b6da3 100644 --- a/src/Exercism.TestRunner.FSharp/Testing.fs +++ b/src/Exercism.TestRunner.FSharp/Testing.fs @@ -237,7 +237,7 @@ module DotnetCli = else error.[lastPathIndex + 1..] - let private removeProjectReference (error: string) = error.[0..(error.LastIndexOf('[') - 1)] + let private removeProjectReference (error: string) = error[.. error.LastIndexOf('[') - 1] let private normalizeBuildError error = error @@ -258,7 +258,7 @@ module DotnetCli = let solutionDir = Path.GetDirectoryName(context.TestsFile) Process.exec "dotnet" "restore --source /root/.nuget/packages/" solutionDir - Process.exec "dotnet" $"test --no-restore --verbosity=quiet --logger \"trx;LogFileName=%s{Path.GetFileName(context.TestResultsFile)}\" /flp:verbosity=quiet;errorsOnly=true" solutionDir + Process.exec "dotnet" $"test -c release --no-restore --verbosity=quiet --logger \"trx;LogFileName={Path.GetFileName(context.TestResultsFile)}\" /flp:verbosity=quiet;errorsOnly=true" solutionDir let buildErrors = parseBuildErrors context diff --git a/src/Exercism.TestRunner.FSharp/Visitor.fs b/src/Exercism.TestRunner.FSharp/Visitor.fs index ec61a7c..d8eae33 100644 --- a/src/Exercism.TestRunner.FSharp/Visitor.fs +++ b/src/Exercism.TestRunner.FSharp/Visitor.fs @@ -348,7 +348,7 @@ type SyntaxVisitor() = | SynMemberDefn.AutoProperty(attrs, isStatic, ident, typeOpt, propKind, flags, flagsForSet, doc, access, synExpr, range, trivia) -> SynMemberDefn.AutoProperty (attrs |> List.map this.VisitSynAttributeList, isStatic, this.VisitIdent ident, - Option.map this.VisitSynType typeOpt, propKind, flags, flagsForSet, this.VisitPreXmlDoc(doc), Option.map this.VisitSynAccess access, + Option.map this.VisitSynType typeOpt, propKind, flags, flagsForSet, this.VisitPreXmlDoc(doc), this.VisitSynValSigAccess access, this.VisitSynExpr synExpr, range, trivia) abstract VisitSynSimplePat: SynSimplePat -> SynSimplePat @@ -395,7 +395,7 @@ type SyntaxVisitor() = SynValSig (attrs |> List.map this.VisitSynAttributeList, this.VisitSynIdent ident, this.VisitSynValTyparDecls explicitValDecls, this.VisitSynType synType, this.VisitSynValInfo arity, - isInline, isMutable, this.VisitPreXmlDoc(doc), Option.map this.VisitSynAccess access, Option.map this.VisitSynExpr expr, + isInline, isMutable, this.VisitPreXmlDoc(doc), this.VisitSynValSigAccess access, Option.map this.VisitSynExpr expr, range, trivia) abstract VisitSynValTyparDecls: SynValTyparDecls -> SynValTyparDecls @@ -632,6 +632,8 @@ type SyntaxVisitor() = SynType.SignatureParameter(List.map this.VisitSynAttributeList synAttributeLists, optional, Option.map this.VisitIdent identOption, this.VisitSynType usedType, range) | SynType.FromParseError range -> SynType.FromParseError range | SynType.Intersection(typar, types, range, trivia) -> SynType.Intersection(Option.map this.VisitSynTypar typar, types |> List.map this.VisitSynType, range, trivia) + | SynType.StaticConstantNull range -> SynType.StaticConstantNull range + | SynType.WithNull(innerType, ambivalent, range, trivia) -> SynType.WithNull(this.VisitSynType(innerType), ambivalent, range, trivia) abstract VisitSynTypeOrTrivia: SynTypeOrTrivia -> SynTypeOrTrivia default this.VisitSynTypeOrTrivia(synTypeOrTrivia: SynTypeOrTrivia): SynTypeOrTrivia = synTypeOrTrivia @@ -664,6 +666,10 @@ type SyntaxVisitor() = abstract VisitSynAccess: SynAccess -> SynAccess default this.VisitSynAccess(a: SynAccess): SynAccess = a + + abstract VisitSynValSigAccess: SynValSigAccess -> SynValSigAccess + + default this.VisitSynValSigAccess(a: SynValSigAccess): SynValSigAccess = a abstract VisitSynBindingKind: SynBindingKind -> SynBindingKind diff --git a/tests/ClassBasedTests/ClassBasedTests.fs b/tests/AllTestsFailing/AllTestsFailing.fs similarity index 73% rename from tests/ClassBasedTests/ClassBasedTests.fs rename to tests/AllTestsFailing/AllTestsFailing.fs index e2b60bf..15e4b45 100644 --- a/tests/ClassBasedTests/ClassBasedTests.fs +++ b/tests/AllTestsFailing/AllTestsFailing.fs @@ -1,4 +1,4 @@ -module ClassBasedTests +module AllTestsFailing let add x y = x + y diff --git a/tests/AllTestsFailing/AllTestsFailing.fsproj b/tests/AllTestsFailing/AllTestsFailing.fsproj new file mode 100644 index 0000000..5e84107 --- /dev/null +++ b/tests/AllTestsFailing/AllTestsFailing.fsproj @@ -0,0 +1,22 @@ + + + + net10.0 + Exercism + false + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/MultipleTestsWithMultipleFails/MultipleTestsWithMultipleFailsTests.fs b/tests/AllTestsFailing/AllTestsFailingTests.fs similarity index 82% rename from tests/MultipleTestsWithMultipleFails/MultipleTestsWithMultipleFailsTests.fs rename to tests/AllTestsFailing/AllTestsFailingTests.fs index 52a64de..d6e1924 100644 --- a/tests/MultipleTestsWithMultipleFails/MultipleTestsWithMultipleFailsTests.fs +++ b/tests/AllTestsFailing/AllTestsFailingTests.fs @@ -1,9 +1,9 @@ -module MultipleTestsWithMultipleFailsTests +module AllTestsFailingTests open Xunit open FsUnit.Xunit open Exercism.Tests -open MultipleTestsWithMultipleFails +open AllTestsFailing [] let ``Add should add numbers`` () = add 1 1 |> should equal 3 diff --git a/tests/MultipleTestsWithMultipleFails/expected_results.json b/tests/AllTestsFailing/expected_results.json similarity index 66% rename from tests/MultipleTestsWithMultipleFails/expected_results.json rename to tests/AllTestsFailing/expected_results.json index 9c5e6a3..145096b 100644 --- a/tests/MultipleTestsWithMultipleFails/expected_results.json +++ b/tests/AllTestsFailing/expected_results.json @@ -5,7 +5,7 @@ { "name": "Add should add numbers", "status": "fail", - "message": "Expected: Equals 3\nActual: 2", + "message": "Assert.Equal() Failure: Values differ\nExpected: \u0022Equals 3\u0022\nActual: \u00222\u0022", "test_code": "add 1 1 |\u003E should equal 3" }, { @@ -16,7 +16,7 @@ { "name": "Mul should multiply numbers", "status": "fail", - "message": "Expected: Equals 7\nActual: 6", + "message": "Assert.Equal() Failure: Values differ\nExpected: \u0022Equals 7\u0022\nActual: \u00226\u0022", "test_code": "mul 2 3 |\u003E should equal 7" } ] diff --git a/tests/AllTestsWithTask/AllTestsWithTask.fs b/tests/AllTestsPassing/AllTestsPassing.fs similarity index 72% rename from tests/AllTestsWithTask/AllTestsWithTask.fs rename to tests/AllTestsPassing/AllTestsPassing.fs index 069a14b..f7fc677 100644 --- a/tests/AllTestsWithTask/AllTestsWithTask.fs +++ b/tests/AllTestsPassing/AllTestsPassing.fs @@ -1,4 +1,4 @@ -module AllTestsWithTask +module AllTestsPassing let add x y = x + y diff --git a/tests/AllTestsPassing/AllTestsPassing.fsproj b/tests/AllTestsPassing/AllTestsPassing.fsproj new file mode 100644 index 0000000..efcf3bc --- /dev/null +++ b/tests/AllTestsPassing/AllTestsPassing.fsproj @@ -0,0 +1,22 @@ + + + + net10.0 + Exercism + false + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/DotnetSevenProject/DotnetSevenProjectTests.fs b/tests/AllTestsPassing/AllTestsPassingTests.fs similarity index 88% rename from tests/DotnetSevenProject/DotnetSevenProjectTests.fs rename to tests/AllTestsPassing/AllTestsPassingTests.fs index fd93a7a..2e3bcf1 100644 --- a/tests/DotnetSevenProject/DotnetSevenProjectTests.fs +++ b/tests/AllTestsPassing/AllTestsPassingTests.fs @@ -1,9 +1,9 @@ -module DotnetSixProjectTests +module AllTestsPassingTests open Xunit open FsUnit.Xunit open Exercism.Tests -open DotnetSixProject +open AllTestsPassing [] let ``Add should add numbers`` () = add 1 1 |> should equal 2 diff --git a/tests/ClassBasedTests/expected_results.json b/tests/AllTestsPassing/expected_results.json similarity index 100% rename from tests/ClassBasedTests/expected_results.json rename to tests/AllTestsPassing/expected_results.json diff --git a/tests/AllTestsWithTask/AllTestsWithTask.fsproj b/tests/AllTestsWithTask/AllTestsWithTask.fsproj deleted file mode 100644 index 5f87bb1..0000000 --- a/tests/AllTestsWithTask/AllTestsWithTask.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/ClassBasedTests/ClassBasedTests.fsproj b/tests/ClassBasedTests/ClassBasedTests.fsproj deleted file mode 100644 index f7c6230..0000000 --- a/tests/ClassBasedTests/ClassBasedTests.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/ClassBasedTests/ClassBasedTestsTests.fs b/tests/ClassBasedTests/ClassBasedTestsTests.fs deleted file mode 100644 index c6e5d60..0000000 --- a/tests/ClassBasedTests/ClassBasedTestsTests.fs +++ /dev/null @@ -1,16 +0,0 @@ -module ClassBasedTestsTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open ClassBasedTests - -type Tests() = - [] - member _.``Add should add numbers``() = add 1 1 |> should equal 2 - - [] - member _.``Sub should subtract numbers``() = sub 7 3 |> should equal 4 - - [] - member _.``Mul should multiply numbers``() = mul 2 3 |> should equal 6 diff --git a/tests/CompileErrors/CompileErrors.fs b/tests/CompileErrors/CompileErrors.fs new file mode 100644 index 0000000..ac1c7d2 --- /dev/null +++ b/tests/CompileErrors/CompileErrors.fs @@ -0,0 +1,3 @@ +module CompileErrors + +let invalid x y = x + y diff --git a/tests/CompileErrors/CompileErrors.fsproj b/tests/CompileErrors/CompileErrors.fsproj new file mode 100644 index 0000000..e5413bd --- /dev/null +++ b/tests/CompileErrors/CompileErrors.fsproj @@ -0,0 +1,22 @@ + + + + net10.0 + Exercism + false + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/MultipleCompileErrors/MultipleCompileErrorsTests.fs b/tests/CompileErrors/CompileErrorsTests.fs similarity index 80% rename from tests/MultipleCompileErrors/MultipleCompileErrorsTests.fs rename to tests/CompileErrors/CompileErrorsTests.fs index ade7dba..fa5c275 100644 --- a/tests/MultipleCompileErrors/MultipleCompileErrorsTests.fs +++ b/tests/CompileErrors/CompileErrorsTests.fs @@ -1,9 +1,9 @@ -module MultipleCompileErrorsTests +module CompileErrorsTests open Xunit open FsUnit.Xunit open Exercism.Tests -open MultipleCompileErrors +open CompileErrors [] let ``Add should add numbers`` () = add 1 1 |> should equal 2 diff --git a/tests/CompileErrors/expected_results.json b/tests/CompileErrors/expected_results.json new file mode 100644 index 0000000..a3e4eaa --- /dev/null +++ b/tests/CompileErrors/expected_results.json @@ -0,0 +1,6 @@ +{ + "version": 3, + "status": "error", + "message": "CompileErrorsTests.fs(9,37): error FS0039: The value or constructor \u0027add\u0027 is not defined.\nCompileErrorsTests.fs(12,37): error FS0039: The value or constructor \u0027sub\u0027 is not defined. Maybe you want one of the following:\u001D subsetOf", + "tests": [] +} \ No newline at end of file diff --git a/tests/DifferentTestCodeFormats/DifferentTestCodeFormats.fsproj b/tests/DifferentTestCodeFormats/DifferentTestCodeFormats.fsproj index 1cf3f4f..cab3aa3 100644 --- a/tests/DifferentTestCodeFormats/DifferentTestCodeFormats.fsproj +++ b/tests/DifferentTestCodeFormats/DifferentTestCodeFormats.fsproj @@ -1,8 +1,8 @@ - net9.0 - + net10.0 + Exercism false @@ -12,11 +12,11 @@ - - - - - + + + + + \ No newline at end of file diff --git a/tests/DifferentTypesOfTests/DifferentTypesOfTests.fsproj b/tests/DifferentTypesOfTests/DifferentTypesOfTests.fsproj index a96d5ee..14b7dcc 100644 --- a/tests/DifferentTypesOfTests/DifferentTypesOfTests.fsproj +++ b/tests/DifferentTypesOfTests/DifferentTypesOfTests.fsproj @@ -1,8 +1,8 @@ - net9.0 - + net10.0 + Exercism false @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/tests/DifferentTypesOfTests/DifferentTypesOfTestsTests.fs b/tests/DifferentTypesOfTests/DifferentTypesOfTestsTests.fs index 2ae252a..e945ee3 100644 --- a/tests/DifferentTypesOfTests/DifferentTypesOfTestsTests.fs +++ b/tests/DifferentTypesOfTests/DifferentTypesOfTestsTests.fs @@ -2,11 +2,12 @@ module DifferentTypesOfTestsTests open System open System.Threading.Tasks + +open FsCheck.FSharp open Xunit open FsUnit.Xunit open FsCheck open FsCheck.Xunit -open Exercism.Tests open DifferentTypesOfTests type CustomPropertyAttribute() = @@ -14,8 +15,9 @@ type CustomPropertyAttribute() = type Letters = static member Chars () = - Arb.Default.Char() - |> Arb.filter (fun c -> 'A' <= c && c <= 'Z') + ArbMap.defaults + |> ArbMap.arbitrary + |> Arb.mapFilter id (fun c -> 'A' <= c && c <= 'Z') type LetterAttribute () = inherit PropertyAttribute(Arbitrary = [| typeof |]) @@ -43,3 +45,13 @@ let ``Letter should be uppercase`` (letter) = Char.IsUpper(letter) |> should equ [] let ``Div should divide numbers`` (x) : Property = Prop.throws (new Lazy(fun () -> x / 0)) + +type ClassBasedTests() = + [] + member _.``Add should add numbers``() = add 1 1 |> should equal 2 + + [] + member _.``Sub should subtract numbers``() = sub 7 3 |> should equal 4 + + [] + member _.``Mul should multiply numbers``() = mul 2 3 |> should equal 6 diff --git a/tests/DifferentTypesOfTests/expected_results.json b/tests/DifferentTypesOfTests/expected_results.json index 7c1f09e..28d8dc0 100644 --- a/tests/DifferentTypesOfTests/expected_results.json +++ b/tests/DifferentTypesOfTests/expected_results.json @@ -2,11 +2,6 @@ "version": 3, "status": "fail", "tests": [ - { - "name": "Add should add numbers", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2" - }, { "name": "Add should add more numbers", "status": "pass", @@ -18,28 +13,45 @@ "message": "Test execution timed out after 20 milliseconds", "test_code": "Task.Delay(TimeSpan.FromMilliseconds(100.0))" }, + { + "name": "Letter should be uppercase", + "status": "pass", + "test_code": "Char.IsUpper(letter) |\u003E should equal true" + }, + { + "name": "Div should divide numbers", + "status": "pass", + "test_code": "Prop.throws\u003CDivideByZeroException, int\u003E (new Lazy\u003Cint\u003E(fun () -\u003E x / 0))" + }, + { + "name": "Add should add numbers", + "status": "pass", + "test_code": "add 1 1 |\u003E should equal 2" + }, + { + "name": "Add should add numbers", + "status": "pass", + "test_code": "add 1 1 |\u003E should equal 2" + }, { "name": "Sub should subtract numbers", "status": "pass", - "test_code": "sub x y |\u003E should equal expected" + "test_code": "sub 7 3 |\u003E should equal 4" }, { - "name": "Mul should multiply numbers", + "name": "Sub should subtract numbers", "status": "pass", - "output": "Ok, passed 100 tests.", - "test_code": "mul x y |\u003E should equal (x * y)" + "test_code": "sub 7 3 |\u003E should equal 4" }, { - "name": "Letter should be uppercase", + "name": "Mul should multiply numbers", "status": "pass", - "output": "Ok, passed 100 tests.", - "test_code": "Char.IsUpper(letter) |\u003E should equal true" + "test_code": "mul 2 3 |\u003E should equal 6" }, { - "name": "Div should divide numbers", + "name": "Mul should multiply numbers", "status": "pass", - "output": "Ok, passed 100 tests.", - "test_code": "Prop.throws\u003CDivideByZeroException, int\u003E (new Lazy\u003Cint\u003E(fun () -\u003E x / 0))" + "test_code": "mul 2 3 |\u003E should equal 6" } ] } \ No newline at end of file diff --git a/tests/DotnetEightProject/DotnetEightProject.fsproj b/tests/DotnetEightProject/DotnetEightProject.fsproj deleted file mode 100644 index 96beb26..0000000 --- a/tests/DotnetEightProject/DotnetEightProject.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net8.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/DotnetFiveProject/DotnetFiveProject.fsproj b/tests/DotnetFiveProject/DotnetFiveProject.fsproj deleted file mode 100644 index e274620..0000000 --- a/tests/DotnetFiveProject/DotnetFiveProject.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net5.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/DotnetFiveProject/DotnetFiveProjectTests.fs b/tests/DotnetFiveProject/DotnetFiveProjectTests.fs deleted file mode 100644 index fc24612..0000000 --- a/tests/DotnetFiveProject/DotnetFiveProjectTests.fs +++ /dev/null @@ -1,15 +0,0 @@ -module DotnetFiveProjectTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open DotnetFiveProject - -[] -let ``Add should add numbers`` () = add 1 1 |> should equal 2 - -[] -let ``Sub should subtract numbers`` () = sub 7 3 |> should equal 4 - -[] -let ``Mul should multiply numbers`` () = mul 2 3 |> should equal 6 diff --git a/tests/DotnetFiveProject/expected_results.json b/tests/DotnetFiveProject/expected_results.json deleted file mode 100644 index ce56be2..0000000 --- a/tests/DotnetFiveProject/expected_results.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "name": "Add should add numbers", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2" - }, - { - "name": "Sub should subtract numbers", - "status": "pass", - "test_code": "sub 7 3 |\u003E should equal 4" - }, - { - "name": "Mul should multiply numbers", - "status": "pass", - "test_code": "mul 2 3 |\u003E should equal 6" - } - ] -} \ No newline at end of file diff --git a/tests/DotnetEightProject/DotnetEightProject.fs b/tests/DotnetNine/DotnetNine.fs similarity index 72% rename from tests/DotnetEightProject/DotnetEightProject.fs rename to tests/DotnetNine/DotnetNine.fs index 863d2cc..47f7202 100644 --- a/tests/DotnetEightProject/DotnetEightProject.fs +++ b/tests/DotnetNine/DotnetNine.fs @@ -1,4 +1,4 @@ -module DotnetSixProject +module DotnetNine let add x y = x + y diff --git a/tests/Warnings/Warnings.fsproj b/tests/DotnetNine/DotnetNine.fsproj similarity index 52% rename from tests/Warnings/Warnings.fsproj rename to tests/DotnetNine/DotnetNine.fsproj index 82b88d3..34fff5b 100644 --- a/tests/Warnings/Warnings.fsproj +++ b/tests/DotnetNine/DotnetNine.fsproj @@ -2,21 +2,20 @@ net9.0 - false - - + + - - - - - + + + + + \ No newline at end of file diff --git a/tests/DotnetEightProject/DotnetEightProjectTests.fs b/tests/DotnetNine/DotnetNineTests.fs similarity index 88% rename from tests/DotnetEightProject/DotnetEightProjectTests.fs rename to tests/DotnetNine/DotnetNineTests.fs index fd93a7a..89aa581 100644 --- a/tests/DotnetEightProject/DotnetEightProjectTests.fs +++ b/tests/DotnetNine/DotnetNineTests.fs @@ -1,9 +1,9 @@ -module DotnetSixProjectTests +module DotnetNineTests open Xunit open FsUnit.Xunit open Exercism.Tests -open DotnetSixProject +open DotnetNine [] let ``Add should add numbers`` () = add 1 1 |> should equal 2 diff --git a/tests/DotnetEightProject/expected_results.json b/tests/DotnetNine/expected_results.json similarity index 100% rename from tests/DotnetEightProject/expected_results.json rename to tests/DotnetNine/expected_results.json diff --git a/tests/DotnetSevenProject/DotnetSevenProject.fsproj b/tests/DotnetSevenProject/DotnetSevenProject.fsproj deleted file mode 100644 index 7ca81b5..0000000 --- a/tests/DotnetSevenProject/DotnetSevenProject.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net7.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/DotnetSevenProject/expected_results.json b/tests/DotnetSevenProject/expected_results.json deleted file mode 100644 index ce56be2..0000000 --- a/tests/DotnetSevenProject/expected_results.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "name": "Add should add numbers", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2" - }, - { - "name": "Sub should subtract numbers", - "status": "pass", - "test_code": "sub 7 3 |\u003E should equal 4" - }, - { - "name": "Mul should multiply numbers", - "status": "pass", - "test_code": "mul 2 3 |\u003E should equal 6" - } - ] -} \ No newline at end of file diff --git a/tests/DotnetSixProject/DotnetSixProject.fs b/tests/DotnetSixProject/DotnetSixProject.fs deleted file mode 100644 index 863d2cc..0000000 --- a/tests/DotnetSixProject/DotnetSixProject.fs +++ /dev/null @@ -1,7 +0,0 @@ -module DotnetSixProject - -let add x y = x + y - -let sub x y = x - y - -let mul x y = x * y diff --git a/tests/DotnetSixProject/DotnetSixProject.fsproj b/tests/DotnetSixProject/DotnetSixProject.fsproj deleted file mode 100644 index 59ba860..0000000 --- a/tests/DotnetSixProject/DotnetSixProject.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net6.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/DotnetSixProject/expected_results.json b/tests/DotnetSixProject/expected_results.json deleted file mode 100644 index ce56be2..0000000 --- a/tests/DotnetSixProject/expected_results.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "name": "Add should add numbers", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2" - }, - { - "name": "Sub should subtract numbers", - "status": "pass", - "test_code": "sub 7 3 |\u003E should equal 4" - }, - { - "name": "Mul should multiply numbers", - "status": "pass", - "test_code": "mul 2 3 |\u003E should equal 6" - } - ] -} \ No newline at end of file diff --git a/tests/MultipleCompileErrors/MultipleCompileErrors.fs b/tests/MultipleCompileErrors/MultipleCompileErrors.fs deleted file mode 100644 index 38b0bfc..0000000 --- a/tests/MultipleCompileErrors/MultipleCompileErrors.fs +++ /dev/null @@ -1,3 +0,0 @@ -module MultipleCompileErrors - -let invalid x y = x + y diff --git a/tests/MultipleCompileErrors/MultipleCompileErrors.fsproj b/tests/MultipleCompileErrors/MultipleCompileErrors.fsproj deleted file mode 100644 index 9c2f466..0000000 --- a/tests/MultipleCompileErrors/MultipleCompileErrors.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/MultipleCompileErrors/expected_results.json b/tests/MultipleCompileErrors/expected_results.json deleted file mode 100644 index d32e0fb..0000000 --- a/tests/MultipleCompileErrors/expected_results.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "status": "error", - "message": "MultipleCompileErrorsTests.fs(9,37): error FS0039: The value or constructor \u0027add\u0027 is not defined.\nMultipleCompileErrorsTests.fs(12,37): error FS0039: The value or constructor \u0027sub\u0027 is not defined. Maybe you want one of the following:\u001D subsetOf", - "tests": [] -} \ No newline at end of file diff --git a/tests/MultipleTestsWithAllPasses/MultipleTestsWithAllPasses.fs b/tests/MultipleTestsWithAllPasses/MultipleTestsWithAllPasses.fs deleted file mode 100644 index 897942f..0000000 --- a/tests/MultipleTestsWithAllPasses/MultipleTestsWithAllPasses.fs +++ /dev/null @@ -1,7 +0,0 @@ -module MultipleTestsWithAllPasses - -let add x y = x + y - -let sub x y = x - y - -let mul x y = x * y diff --git a/tests/MultipleTestsWithAllPasses/MultipleTestsWithAllPasses.fsproj b/tests/MultipleTestsWithAllPasses/MultipleTestsWithAllPasses.fsproj deleted file mode 100644 index 7af907d..0000000 --- a/tests/MultipleTestsWithAllPasses/MultipleTestsWithAllPasses.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/MultipleTestsWithAllPasses/MultipleTestsWithAllPassesTests.fs b/tests/MultipleTestsWithAllPasses/MultipleTestsWithAllPassesTests.fs deleted file mode 100644 index 7d763fb..0000000 --- a/tests/MultipleTestsWithAllPasses/MultipleTestsWithAllPassesTests.fs +++ /dev/null @@ -1,15 +0,0 @@ -module MultipleTestsWithAllPassesTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open MultipleTestsWithAllPasses - -[] -let ``Add should add numbers`` () = add 1 1 |> should equal 2 - -[] -let ``Sub should subtract numbers`` () = sub 7 3 |> should equal 4 - -[] -let ``Mul should multiply numbers`` () = mul 2 3 |> should equal 6 diff --git a/tests/MultipleTestsWithAllPasses/expected_results.json b/tests/MultipleTestsWithAllPasses/expected_results.json deleted file mode 100644 index ce56be2..0000000 --- a/tests/MultipleTestsWithAllPasses/expected_results.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "name": "Add should add numbers", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2" - }, - { - "name": "Sub should subtract numbers", - "status": "pass", - "test_code": "sub 7 3 |\u003E should equal 4" - }, - { - "name": "Mul should multiply numbers", - "status": "pass", - "test_code": "mul 2 3 |\u003E should equal 6" - } - ] -} \ No newline at end of file diff --git a/tests/MultipleTestsWithMultipleFails/MultipleTestsWithMultipleFails.fs b/tests/MultipleTestsWithMultipleFails/MultipleTestsWithMultipleFails.fs deleted file mode 100644 index 14b33ba..0000000 --- a/tests/MultipleTestsWithMultipleFails/MultipleTestsWithMultipleFails.fs +++ /dev/null @@ -1,7 +0,0 @@ -module MultipleTestsWithMultipleFails - -let add x y = x + y - -let sub x y = x - y - -let mul x y = x * y diff --git a/tests/MultipleTestsWithMultipleFails/MultipleTestsWithMultipleFails.fsproj b/tests/MultipleTestsWithMultipleFails/MultipleTestsWithMultipleFails.fsproj deleted file mode 100644 index ea9cfc5..0000000 --- a/tests/MultipleTestsWithMultipleFails/MultipleTestsWithMultipleFails.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/MultipleTestsWithSingleFail/MultipleTestsWithSingleFail.fs b/tests/MultipleTestsWithSingleFail/MultipleTestsWithSingleFail.fs deleted file mode 100644 index bfdb29d..0000000 --- a/tests/MultipleTestsWithSingleFail/MultipleTestsWithSingleFail.fs +++ /dev/null @@ -1,7 +0,0 @@ -module MultipleTestsWithSingleFail - -let add x y = x + y - -let sub x y = x - y - -let mul x y = x * y diff --git a/tests/MultipleTestsWithSingleFail/MultipleTestsWithSingleFail.fsproj b/tests/MultipleTestsWithSingleFail/MultipleTestsWithSingleFail.fsproj deleted file mode 100644 index 1f6471f..0000000 --- a/tests/MultipleTestsWithSingleFail/MultipleTestsWithSingleFail.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/MultipleTestsWithTestOutput/MultipleTestsWithTestOutput.fsproj b/tests/MultipleTestsWithTestOutput/MultipleTestsWithTestOutput.fsproj deleted file mode 100644 index 59f854b..0000000 --- a/tests/MultipleTestsWithTestOutput/MultipleTestsWithTestOutput.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/MultipleTestsWithTestOutput/MultipleTestsWithTestOutputTests.fs b/tests/MultipleTestsWithTestOutput/MultipleTestsWithTestOutputTests.fs deleted file mode 100644 index 0b6b59b..0000000 --- a/tests/MultipleTestsWithTestOutput/MultipleTestsWithTestOutputTests.fs +++ /dev/null @@ -1,15 +0,0 @@ -module MultipleTestsWithTestOutputTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open MultipleTestsWithTestOutput - -[] -let ``Add should add numbers`` () = add 1 1 |> should equal 2 - -[] -let ``Sub should subtract numbers`` () = sub 7 3 |> should equal 4 - -[] -let ``Mul should multiply numbers`` () = mul 2 3 |> should equal 6 diff --git a/tests/MultipleTestsWithTestOutputExceedingLimit/MultipleTestsWithTestOutputExceedingLimit.fs b/tests/MultipleTestsWithTestOutputExceedingLimit/MultipleTestsWithTestOutputExceedingLimit.fs deleted file mode 100644 index 95831aa..0000000 --- a/tests/MultipleTestsWithTestOutputExceedingLimit/MultipleTestsWithTestOutputExceedingLimit.fs +++ /dev/null @@ -1,10 +0,0 @@ -module MultipleTestsWithTestOutputExceedingLimit - -let add x y = - printfn "%s" (System.String('a', 498) + "bcd") - - x + y - -let sub x y = x - y - -let mul x y = x * y diff --git a/tests/MultipleTestsWithTestOutputExceedingLimit/MultipleTestsWithTestOutputExceedingLimit.fsproj b/tests/MultipleTestsWithTestOutputExceedingLimit/MultipleTestsWithTestOutputExceedingLimit.fsproj deleted file mode 100644 index 9fada42..0000000 --- a/tests/MultipleTestsWithTestOutputExceedingLimit/MultipleTestsWithTestOutputExceedingLimit.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/MultipleTestsWithTestOutputExceedingLimit/MultipleTestsWithTestOutputExceedingLimitTests.fs b/tests/MultipleTestsWithTestOutputExceedingLimit/MultipleTestsWithTestOutputExceedingLimitTests.fs deleted file mode 100644 index f84fb24..0000000 --- a/tests/MultipleTestsWithTestOutputExceedingLimit/MultipleTestsWithTestOutputExceedingLimitTests.fs +++ /dev/null @@ -1,15 +0,0 @@ -module MultipleTestsWithTestOutputExceedingLimitTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open MultipleTestsWithTestOutputExceedingLimit - -[] -let ``Add should add numbers`` () = add 1 1 |> should equal 2 - -[] -let ``Sub should subtract numbers`` () = sub 7 3 |> should equal 4 - -[] -let ``Mul should multiply numbers`` () = mul 2 3 |> should equal 6 diff --git a/tests/MultipleTestsWithTestOutputExceedingLimit/expected_results.json b/tests/MultipleTestsWithTestOutputExceedingLimit/expected_results.json deleted file mode 100644 index ce56be2..0000000 --- a/tests/MultipleTestsWithTestOutputExceedingLimit/expected_results.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "name": "Add should add numbers", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2" - }, - { - "name": "Sub should subtract numbers", - "status": "pass", - "test_code": "sub 7 3 |\u003E should equal 4" - }, - { - "name": "Mul should multiply numbers", - "status": "pass", - "test_code": "mul 2 3 |\u003E should equal 6" - } - ] -} \ No newline at end of file diff --git a/tests/NotImplemented/NotImplemented.fsproj b/tests/NotImplemented/NotImplemented.fsproj index 6b5505f..5f4036e 100644 --- a/tests/NotImplemented/NotImplemented.fsproj +++ b/tests/NotImplemented/NotImplemented.fsproj @@ -1,8 +1,8 @@ - net9.0 - + net10.0 + Exercism false @@ -12,11 +12,11 @@ - - - - - + + + + + \ No newline at end of file diff --git a/tests/DotnetFiveProject/DotnetFiveProject.fs b/tests/PartiallyFailingTests/PartiallyFailingTests.fs similarity index 68% rename from tests/DotnetFiveProject/DotnetFiveProject.fs rename to tests/PartiallyFailingTests/PartiallyFailingTests.fs index 308f987..a383bf0 100644 --- a/tests/DotnetFiveProject/DotnetFiveProject.fs +++ b/tests/PartiallyFailingTests/PartiallyFailingTests.fs @@ -1,4 +1,4 @@ -module DotnetFiveProject +module PartiallyFailingTests let add x y = x + y diff --git a/tests/PartiallyFailingTests/PartiallyFailingTests.fsproj b/tests/PartiallyFailingTests/PartiallyFailingTests.fsproj new file mode 100644 index 0000000..5a1177a --- /dev/null +++ b/tests/PartiallyFailingTests/PartiallyFailingTests.fsproj @@ -0,0 +1,22 @@ + + + + net10.0 + Exercism + false + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/MultipleTestsWithSingleFail/MultipleTestsWithSingleFailTests.fs b/tests/PartiallyFailingTests/PartiallyFailingTestsTests.fs similarity index 83% rename from tests/MultipleTestsWithSingleFail/MultipleTestsWithSingleFailTests.fs rename to tests/PartiallyFailingTests/PartiallyFailingTestsTests.fs index e10c5a7..65ca15a 100644 --- a/tests/MultipleTestsWithSingleFail/MultipleTestsWithSingleFailTests.fs +++ b/tests/PartiallyFailingTests/PartiallyFailingTestsTests.fs @@ -1,9 +1,9 @@ -module MultipleTestsWithSingleFailTests +module PartiallyFailingTestsTests open Xunit open FsUnit.Xunit open Exercism.Tests -open MultipleTestsWithSingleFail +open PartiallyFailingTests [] let ``Add should add numbers`` () = add 1 1 |> should equal 2 diff --git a/tests/MultipleTestsWithSingleFail/expected_results.json b/tests/PartiallyFailingTests/expected_results.json similarity index 79% rename from tests/MultipleTestsWithSingleFail/expected_results.json rename to tests/PartiallyFailingTests/expected_results.json index 1fc82fb..081057f 100644 --- a/tests/MultipleTestsWithSingleFail/expected_results.json +++ b/tests/PartiallyFailingTests/expected_results.json @@ -15,7 +15,7 @@ { "name": "Mul should multiply numbers", "status": "fail", - "message": "Expected: Equals 5\nActual: 6", + "message": "Assert.Equal() Failure: Values differ\nExpected: \u0022Equals 5\u0022\nActual: \u00226\u0022", "test_code": "mul 2 3 |\u003E should equal 5" } ] diff --git a/tests/QuotedAndNonQuotedTests/QuotedAndNonQuotedTests.fsproj b/tests/QuotedAndNonQuotedTests/QuotedAndNonQuotedTests.fsproj deleted file mode 100644 index db57b83..0000000 --- a/tests/QuotedAndNonQuotedTests/QuotedAndNonQuotedTests.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/QuotedAndNonQuotedTests/QuotedAndNonQuotedTests.fs b/tests/QuotedAndUnqotedTestNames/QuotedAndUnqotedTestNames.fs similarity index 56% rename from tests/QuotedAndNonQuotedTests/QuotedAndNonQuotedTests.fs rename to tests/QuotedAndUnqotedTestNames/QuotedAndUnqotedTestNames.fs index 2287316..f2c3a5e 100644 --- a/tests/QuotedAndNonQuotedTests/QuotedAndNonQuotedTests.fs +++ b/tests/QuotedAndUnqotedTestNames/QuotedAndUnqotedTestNames.fs @@ -1,4 +1,4 @@ -module QuotedAndNonQuotedTests +module QuotedAndUnqotedTestNames let add x y = x + y diff --git a/tests/QuotedAndUnqotedTestNames/QuotedAndUnqotedTestNames.fsproj b/tests/QuotedAndUnqotedTestNames/QuotedAndUnqotedTestNames.fsproj new file mode 100644 index 0000000..79a6c48 --- /dev/null +++ b/tests/QuotedAndUnqotedTestNames/QuotedAndUnqotedTestNames.fsproj @@ -0,0 +1,22 @@ + + + + net10.0 + Exercism + false + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/QuotedAndNonQuotedTests/QuotedAndNonQuotedTestsTests.fs b/tests/QuotedAndUnqotedTestNames/QuotedAndUnqotedTestNamesTests.fs similarity index 78% rename from tests/QuotedAndNonQuotedTests/QuotedAndNonQuotedTestsTests.fs rename to tests/QuotedAndUnqotedTestNames/QuotedAndUnqotedTestNamesTests.fs index 5ecd9ae..f131b1f 100644 --- a/tests/QuotedAndNonQuotedTests/QuotedAndNonQuotedTestsTests.fs +++ b/tests/QuotedAndUnqotedTestNames/QuotedAndUnqotedTestNamesTests.fs @@ -1,9 +1,9 @@ -module QuotedAndNonQuotedTestsTests +module QuotedAndUnqotedTestNamesTests open Xunit open FsUnit.Xunit open Exercism.Tests -open QuotedAndNonQuotedTests +open QuotedAndUnqotedTestNames [] let ``Add should add numbers`` () = add 1 1 |> should equal 2 diff --git a/tests/QuotedAndNonQuotedTests/expected_results.json b/tests/QuotedAndUnqotedTestNames/expected_results.json similarity index 100% rename from tests/QuotedAndNonQuotedTests/expected_results.json rename to tests/QuotedAndUnqotedTestNames/expected_results.json diff --git a/tests/SingleCompileError/SingleCompileError.fs b/tests/SingleCompileError/SingleCompileError.fs deleted file mode 100644 index 127a501..0000000 --- a/tests/SingleCompileError/SingleCompileError.fs +++ /dev/null @@ -1,3 +0,0 @@ -module SingleCompileError - -let invalid x y = x + y diff --git a/tests/SingleCompileError/SingleCompileError.fsproj b/tests/SingleCompileError/SingleCompileError.fsproj deleted file mode 100644 index cf8c5af..0000000 --- a/tests/SingleCompileError/SingleCompileError.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/SingleCompileError/SingleCompileErrorTests.fs b/tests/SingleCompileError/SingleCompileErrorTests.fs deleted file mode 100644 index 4ce3125..0000000 --- a/tests/SingleCompileError/SingleCompileErrorTests.fs +++ /dev/null @@ -1,9 +0,0 @@ -module SingleCompileErrorTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open SingleCompileError - -[] -let ``Add should add numbers`` () = add 1 1 |> should equal 2 diff --git a/tests/SingleCompileError/expected_results.json b/tests/SingleCompileError/expected_results.json deleted file mode 100644 index 4d88dcc..0000000 --- a/tests/SingleCompileError/expected_results.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "status": "error", - "message": "SingleCompileErrorTests.fs(9,37): error FS0039: The value or constructor \u0027add\u0027 is not defined.", - "tests": [] -} \ No newline at end of file diff --git a/tests/SingleTestThatFails/SingleTestThatFails.fs b/tests/SingleTestThatFails/SingleTestThatFails.fs deleted file mode 100644 index d47aabf..0000000 --- a/tests/SingleTestThatFails/SingleTestThatFails.fs +++ /dev/null @@ -1,3 +0,0 @@ -module SingleTestThatFails - -let add x y = x + y diff --git a/tests/SingleTestThatFails/SingleTestThatFails.fsproj b/tests/SingleTestThatFails/SingleTestThatFails.fsproj deleted file mode 100644 index 29f7c3e..0000000 --- a/tests/SingleTestThatFails/SingleTestThatFails.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/SingleTestThatFails/SingleTestThatFailsTests.fs b/tests/SingleTestThatFails/SingleTestThatFailsTests.fs deleted file mode 100644 index 90a3a4a..0000000 --- a/tests/SingleTestThatFails/SingleTestThatFailsTests.fs +++ /dev/null @@ -1,9 +0,0 @@ -module SingleTestThatFailsTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open SingleTestThatFails - -[] -let ``Add should add numbers`` () = add 1 1 |> should equal 3 diff --git a/tests/SingleTestThatFails/expected_results.json b/tests/SingleTestThatFails/expected_results.json deleted file mode 100644 index 86e1338..0000000 --- a/tests/SingleTestThatFails/expected_results.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 3, - "status": "fail", - "tests": [ - { - "name": "Add should add numbers", - "status": "fail", - "message": "Expected: Equals 3\nActual: 2", - "test_code": "add 1 1 |\u003E should equal 3" - } - ] -} \ No newline at end of file diff --git a/tests/SingleTestThatPasses/SingleTestThatPasses.fs b/tests/SingleTestThatPasses/SingleTestThatPasses.fs deleted file mode 100644 index 9dd4c74..0000000 --- a/tests/SingleTestThatPasses/SingleTestThatPasses.fs +++ /dev/null @@ -1,3 +0,0 @@ -module SingleTestThatPasses - -let add x y = x + y diff --git a/tests/SingleTestThatPasses/SingleTestThatPasses.fsproj b/tests/SingleTestThatPasses/SingleTestThatPasses.fsproj deleted file mode 100644 index 7492e2f..0000000 --- a/tests/SingleTestThatPasses/SingleTestThatPasses.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/SingleTestThatPasses/SingleTestThatPassesTests.fs b/tests/SingleTestThatPasses/SingleTestThatPassesTests.fs deleted file mode 100644 index 52ebdf9..0000000 --- a/tests/SingleTestThatPasses/SingleTestThatPassesTests.fs +++ /dev/null @@ -1,9 +0,0 @@ -module SingleTestThatPassesTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open SingleTestThatPasses - -[] -let ``Add should add numbers`` () = add 1 1 |> should equal 2 diff --git a/tests/SingleTestThatPasses/expected_results.json b/tests/SingleTestThatPasses/expected_results.json deleted file mode 100644 index 31b28e4..0000000 --- a/tests/SingleTestThatPasses/expected_results.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "name": "Add should add numbers", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2" - } - ] -} \ No newline at end of file diff --git a/tests/SomeTestsWithTask/SomeTestsWithTask.fs b/tests/SomeTestsWithTask/SomeTestsWithTask.fs deleted file mode 100644 index 1c54fd3..0000000 --- a/tests/SomeTestsWithTask/SomeTestsWithTask.fs +++ /dev/null @@ -1,7 +0,0 @@ -module SomeTestsWithTask - -let add x y = x + y - -let sub x y = x - y - -let mul x y = x * y diff --git a/tests/SomeTestsWithTask/SomeTestsWithTask.fsproj b/tests/SomeTestsWithTask/SomeTestsWithTask.fsproj deleted file mode 100644 index d90d798..0000000 --- a/tests/SomeTestsWithTask/SomeTestsWithTask.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/SomeTestsWithTask/SomeTestsWithTaskTests.fs b/tests/SomeTestsWithTask/SomeTestsWithTaskTests.fs deleted file mode 100644 index 159aa9a..0000000 --- a/tests/SomeTestsWithTask/SomeTestsWithTaskTests.fs +++ /dev/null @@ -1,17 +0,0 @@ -module SomeTestsWithTaskTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open SomeTestsWithTask - -[] -[] -let ``Add should add numbers`` () = add 1 1 |> should equal 2 - -[] -let ``Sub should subtract numbers`` () = sub 7 3 |> should equal 4 - -[] -[] -let ``Mul should multiply numbers`` () = mul 2 3 |> should equal 6 diff --git a/tests/SomeTestsWithTask/expected_results.json b/tests/SomeTestsWithTask/expected_results.json deleted file mode 100644 index 9ec8f3d..0000000 --- a/tests/SomeTestsWithTask/expected_results.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "name": "Add should add numbers", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2", - "task_id": 1 - }, - { - "name": "Sub should subtract numbers", - "status": "pass", - "test_code": "sub 7 3 |\u003E should equal 4" - }, - { - "name": "Mul should multiply numbers", - "status": "pass", - "test_code": "mul 2 3 |\u003E should equal 6", - "task_id": 3 - } - ] -} \ No newline at end of file diff --git a/tests/MultipleTestsWithTestOutput/MultipleTestsWithTestOutput.fs b/tests/TestOutput/TestOutput.fs similarity index 75% rename from tests/MultipleTestsWithTestOutput/MultipleTestsWithTestOutput.fs rename to tests/TestOutput/TestOutput.fs index 54de114..20870c7 100644 --- a/tests/MultipleTestsWithTestOutput/MultipleTestsWithTestOutput.fs +++ b/tests/TestOutput/TestOutput.fs @@ -1,4 +1,4 @@ -module MultipleTestsWithTestOutput +module TestOutput let add x y = printf "Printf and" @@ -14,4 +14,7 @@ let sub x y = x * y + 1 -let mul x y = x * y +let mul x y = + printfn "%s" (System.String('a', 498) + "bcd") + + x * y diff --git a/tests/TestOutput/TestOutput.fsproj b/tests/TestOutput/TestOutput.fsproj new file mode 100644 index 0000000..9538a9a --- /dev/null +++ b/tests/TestOutput/TestOutput.fsproj @@ -0,0 +1,22 @@ + + + + net10.0 + Exercism + false + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/DotnetSixProject/DotnetSixProjectTests.fs b/tests/TestOutput/TestOutputTests.fs similarity index 88% rename from tests/DotnetSixProject/DotnetSixProjectTests.fs rename to tests/TestOutput/TestOutputTests.fs index fd93a7a..1320e73 100644 --- a/tests/DotnetSixProject/DotnetSixProjectTests.fs +++ b/tests/TestOutput/TestOutputTests.fs @@ -1,9 +1,9 @@ -module DotnetSixProjectTests +module TestOutputTests open Xunit open FsUnit.Xunit open Exercism.Tests -open DotnetSixProject +open TestOutput [] let ``Add should add numbers`` () = add 1 1 |> should equal 2 diff --git a/tests/MultipleTestsWithTestOutput/expected_results.json b/tests/TestOutput/expected_results.json similarity index 79% rename from tests/MultipleTestsWithTestOutput/expected_results.json rename to tests/TestOutput/expected_results.json index 0a7dbb3..95d7a87 100644 --- a/tests/MultipleTestsWithTestOutput/expected_results.json +++ b/tests/TestOutput/expected_results.json @@ -10,7 +10,7 @@ { "name": "Sub should subtract numbers", "status": "fail", - "message": "Expected: Equals 4\nActual: 22", + "message": "Assert.Equal() Failure: Values differ\nExpected: \u0022Equals 4\u0022\nActual: \u002222\u0022", "test_code": "sub 7 3 |\u003E should equal 4" }, { diff --git a/tests/TestWithParentheses/TestWithParentheses.fs b/tests/TestWithParentheses/TestWithParentheses.fs deleted file mode 100644 index fb405aa..0000000 --- a/tests/TestWithParentheses/TestWithParentheses.fs +++ /dev/null @@ -1,3 +0,0 @@ -module TestWithParentheses - -let add x y = x + y diff --git a/tests/TestWithParentheses/TestWithParentheses.fsproj b/tests/TestWithParentheses/TestWithParentheses.fsproj deleted file mode 100644 index 6968057..0000000 --- a/tests/TestWithParentheses/TestWithParentheses.fsproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net9.0 - - false - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/TestWithParentheses/TestWithParenthesesTests.fs b/tests/TestWithParentheses/TestWithParenthesesTests.fs deleted file mode 100644 index dc2c59e..0000000 --- a/tests/TestWithParentheses/TestWithParenthesesTests.fs +++ /dev/null @@ -1,9 +0,0 @@ -module TestWithParenthesesTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open TestWithParentheses - -[] -let ``Add should add numbers (okay-ish)`` () = add 1 1 |> should equal 2 diff --git a/tests/TestWithParentheses/expected_results.json b/tests/TestWithParentheses/expected_results.json deleted file mode 100644 index bd7a361..0000000 --- a/tests/TestWithParentheses/expected_results.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "name": "Add should add numbers (okay-ish)", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2" - } - ] -} \ No newline at end of file diff --git a/tests/DotnetSevenProject/DotnetSevenProject.fs b/tests/TestsWithTask/TestsWithTask.fs similarity index 72% rename from tests/DotnetSevenProject/DotnetSevenProject.fs rename to tests/TestsWithTask/TestsWithTask.fs index 863d2cc..0475b02 100644 --- a/tests/DotnetSevenProject/DotnetSevenProject.fs +++ b/tests/TestsWithTask/TestsWithTask.fs @@ -1,4 +1,4 @@ -module DotnetSixProject +module TestsWithTask let add x y = x + y diff --git a/tests/TestsWithTask/TestsWithTask.fsproj b/tests/TestsWithTask/TestsWithTask.fsproj new file mode 100644 index 0000000..3d0fb81 --- /dev/null +++ b/tests/TestsWithTask/TestsWithTask.fsproj @@ -0,0 +1,22 @@ + + + + net10.0 + Exercism + false + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/AllTestsWithTask/AllTestsWithTaskTests.fs b/tests/TestsWithTask/TestsWithTaskTests.fs similarity index 89% rename from tests/AllTestsWithTask/AllTestsWithTaskTests.fs rename to tests/TestsWithTask/TestsWithTaskTests.fs index 499c523..3b9fa06 100644 --- a/tests/AllTestsWithTask/AllTestsWithTaskTests.fs +++ b/tests/TestsWithTask/TestsWithTaskTests.fs @@ -1,9 +1,9 @@ -module AllTestsWithTaskTests +module TestsWithTaskTests open Xunit open FsUnit.Xunit open Exercism.Tests -open AllTestsWithTask +open TestsWithTask [] [] diff --git a/tests/AllTestsWithTask/expected_results.json b/tests/TestsWithTask/expected_results.json similarity index 100% rename from tests/AllTestsWithTask/expected_results.json rename to tests/TestsWithTask/expected_results.json diff --git a/tests/UseCultureAttribute/UseCultureAttribute.fsproj b/tests/UseCultureAttribute/UseCultureAttribute.fsproj index c67cdc0..fa8703f 100644 --- a/tests/UseCultureAttribute/UseCultureAttribute.fsproj +++ b/tests/UseCultureAttribute/UseCultureAttribute.fsproj @@ -1,8 +1,8 @@ - net9.0 - + net10.0 + Exercism false @@ -12,11 +12,11 @@ - - - - - + + + + + \ No newline at end of file diff --git a/tests/Warnings/Warnings.fs b/tests/Warnings/Warnings.fs deleted file mode 100644 index afc45ef..0000000 --- a/tests/Warnings/Warnings.fs +++ /dev/null @@ -1,5 +0,0 @@ -module SingleTestThatPasses - -let add x y = - match true with - | true -> x + y diff --git a/tests/Warnings/WarningsTests.fs b/tests/Warnings/WarningsTests.fs deleted file mode 100644 index 52ebdf9..0000000 --- a/tests/Warnings/WarningsTests.fs +++ /dev/null @@ -1,9 +0,0 @@ -module SingleTestThatPassesTests - -open Xunit -open FsUnit.Xunit -open Exercism.Tests -open SingleTestThatPasses - -[] -let ``Add should add numbers`` () = add 1 1 |> should equal 2 diff --git a/tests/Warnings/expected_results.json b/tests/Warnings/expected_results.json deleted file mode 100644 index 31b28e4..0000000 --- a/tests/Warnings/expected_results.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 3, - "status": "pass", - "tests": [ - { - "name": "Add should add numbers", - "status": "pass", - "test_code": "add 1 1 |\u003E should equal 2" - } - ] -} \ No newline at end of file