From 247f29b5e72d376c7f992f3322e578c8f613afcd Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Sun, 13 Aug 2023 14:00:46 +0200 Subject: [PATCH] Add smoke tests (#143) * Remove integration tests project * Rename test files * Convert to tests dir * Remove scripts * Add root bin dir --- .dockerignore | 15 ++---- .github/workflows/test.yml | 28 +++++++--- .gitignore | 2 + Dockerfile | 2 +- Exercism.Representers.FSharp.sln | 8 +-- README.md | 22 +------- bin/run-in-docker.sh | 45 ++++++++++++++++ bin/run-tests-in-docker.sh | 29 ++++++++++ bin/run-tests.sh | 37 +++++++++++++ bin/run.sh | 26 +++++++++ config.json | 3 -- format.ps1 | 18 ------- generate-in-bulk.ps1 | 27 ---------- generate-in-docker.ps1 | 33 ------------ generate.ps1 | 29 ---------- run.sh | 3 -- test.ps1 | 53 ------------------- ...epresenters.FSharp.IntegrationTests.fsproj | 34 ------------ .../Tests.fs | 52 ------------------ .../MultiLineCommentForEntireLines.fs | 0 .../expected_mapping.json | 0 .../expected_representation.json | 1 + .../expected_representation.txt | 0 .../MultiLineCommentForPartOfLine.fs | 0 .../expected_mapping.json | 0 .../expected_representation.json | 1 + .../expected_representation.txt | 0 .../SingleLineCommentForEntireLine.fs | 0 .../expected_mapping.json | 0 .../expected_representation.json | 1 + .../expected_representation.txt | 0 .../SingleLineCommentForPartOfLine.fs | 0 .../expected_mapping.json | 0 .../expected_representation.json | 1 + .../expected_representation.txt | 0 .../Comments/XmlComment/XmlComment.fs | 0 .../Comments/XmlComment/expected_mapping.json | 0 .../XmlComment/expected_representation.json | 1 + .../XmlComment/expected_representation.txt | 0 .../IfElseOnSeparateLines.fs | 0 .../expected_mapping.json | 0 .../expected_representation.json | 1 + .../expected_representation.txt | 0 .../InconsistentWhiteSpace.fs | 0 .../expected_mapping.json | 0 .../expected_representation.json | 1 + .../expected_representation.txt | 0 .../Formatting/Lists/Lists.fs | 0 .../Formatting/Lists/expected_mapping.json | 0 .../Lists/expected_representation.json | 1 + .../Lists/expected_representation.txt | 0 .../TypeDefinitionNotIndented.fs | 0 .../expected_mapping.json | 0 .../expected_representation.json | 1 + .../expected_representation.txt | 0 .../Identifiers/Bindings/Bindings.fs | 0 .../Bindings/expected_mapping.json | 0 .../Bindings/expected_representation.json | 1 + .../Bindings/expected_representation.txt | 0 .../Identifiers/Functions/Functions.fs | 0 .../Functions/expected_mapping.json | 0 .../Functions/expected_representation.json | 1 + .../Functions/expected_representation.txt | 0 .../Identifiers/Lambdas/Lambdas.fs | 0 .../Identifiers/Lambdas/expected_mapping.json | 0 .../Lambdas/expected_representation.json | 1 + .../Lambdas/expected_representation.txt | 0 .../NestedFunctionsAndBindings.fs | 0 .../expected_mapping.json | 0 .../expected_representation.json | 1 + .../expected_representation.txt | 0 .../MultipleImports/MultipleImports.fs | 0 .../MultipleImports/expected_mapping.json | 0 .../expected_representation.json | 1 + .../expected_representation.txt | 0 .../Imports/NoImports/NoImports.fs | 0 .../Imports/NoImports/expected_mapping.json | 0 .../NoImports/expected_representation.json | 1 + .../NoImports/expected_representation.txt | 0 .../Imports/OneImport/OneImport.fs | 0 .../Imports/OneImport/expected_mapping.json | 0 .../OneImport/expected_representation.json | 1 + .../OneImport/expected_representation.txt | 0 83 files changed, 185 insertions(+), 297 deletions(-) create mode 100755 bin/run-in-docker.sh create mode 100755 bin/run-tests-in-docker.sh create mode 100755 bin/run-tests.sh create mode 100755 bin/run.sh delete mode 100644 config.json delete mode 100644 format.ps1 delete mode 100644 generate-in-bulk.ps1 delete mode 100644 generate-in-docker.ps1 delete mode 100644 generate.ps1 delete mode 100644 run.sh delete mode 100644 test.ps1 delete mode 100644 test/Exercism.Representers.FSharp.IntegrationTests/Exercism.Representers.FSharp.IntegrationTests.fsproj delete mode 100644 test/Exercism.Representers.FSharp.IntegrationTests/Tests.fs rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForEntireLines/Fake.fs => tests/Comments/MultiLineCommentForEntireLines/MultiLineCommentForEntireLines.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/MultiLineCommentForEntireLines/expected_mapping.json (100%) create mode 100644 tests/Comments/MultiLineCommentForEntireLines/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/MultiLineCommentForEntireLines/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForPartOfLine/Fake.fs => tests/Comments/MultiLineCommentForPartOfLine/MultiLineCommentForPartOfLine.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/MultiLineCommentForPartOfLine/expected_mapping.json (100%) create mode 100644 tests/Comments/MultiLineCommentForPartOfLine/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/MultiLineCommentForPartOfLine/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForEntireLine/Fake.fs => tests/Comments/SingleLineCommentForEntireLine/SingleLineCommentForEntireLine.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/SingleLineCommentForEntireLine/expected_mapping.json (100%) create mode 100644 tests/Comments/SingleLineCommentForEntireLine/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/SingleLineCommentForEntireLine/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForPartOfLine/Fake.fs => tests/Comments/SingleLineCommentForPartOfLine/SingleLineCommentForPartOfLine.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/SingleLineCommentForPartOfLine/expected_mapping.json (100%) create mode 100644 tests/Comments/SingleLineCommentForPartOfLine/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/SingleLineCommentForPartOfLine/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/XmlComment/Fake.fs => tests/Comments/XmlComment/XmlComment.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/XmlComment/expected_mapping.json (100%) create mode 100644 tests/Comments/XmlComment/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Comments/XmlComment/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/IfElseOnSeparateLines/Fake.fs => tests/Formatting/IfElseOnSeparateLines/IfElseOnSeparateLines.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Formatting/IfElseOnSeparateLines/expected_mapping.json (100%) create mode 100644 tests/Formatting/IfElseOnSeparateLines/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Formatting/IfElseOnSeparateLines/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/InconsistentWhiteSpace/Fake.fs => tests/Formatting/InconsistentWhiteSpace/InconsistentWhiteSpace.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Formatting/InconsistentWhiteSpace/expected_mapping.json (100%) create mode 100644 tests/Formatting/InconsistentWhiteSpace/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Formatting/InconsistentWhiteSpace/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/Lists/Fake.fs => tests/Formatting/Lists/Lists.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Formatting/Lists/expected_mapping.json (100%) create mode 100644 tests/Formatting/Lists/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Formatting/Lists/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/TypeDefinitionNotIndented/Fake.fs => tests/Formatting/TypeDefinitionNotIndented/TypeDefinitionNotIndented.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Formatting/TypeDefinitionNotIndented/expected_mapping.json (100%) create mode 100644 tests/Formatting/TypeDefinitionNotIndented/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Formatting/TypeDefinitionNotIndented/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Bindings/Fake.fs => tests/Identifiers/Bindings/Bindings.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Identifiers/Bindings/expected_mapping.json (100%) create mode 100644 tests/Identifiers/Bindings/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Identifiers/Bindings/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Functions/Fake.fs => tests/Identifiers/Functions/Functions.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Identifiers/Functions/expected_mapping.json (100%) create mode 100644 tests/Identifiers/Functions/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Identifiers/Functions/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Lambdas/Fake.fs => tests/Identifiers/Lambdas/Lambdas.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Identifiers/Lambdas/expected_mapping.json (100%) create mode 100644 tests/Identifiers/Lambdas/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Identifiers/Lambdas/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/NestedFunctionsAndBindings/Fake.fs => tests/Identifiers/NestedFunctionsAndBindings/NestedFunctionsAndBindings.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Identifiers/NestedFunctionsAndBindings/expected_mapping.json (100%) create mode 100644 tests/Identifiers/NestedFunctionsAndBindings/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Identifiers/NestedFunctionsAndBindings/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/MultipleImports/Fake.fs => tests/Imports/MultipleImports/MultipleImports.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Imports/MultipleImports/expected_mapping.json (100%) create mode 100644 tests/Imports/MultipleImports/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Imports/MultipleImports/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/NoImports/Fake.fs => tests/Imports/NoImports/NoImports.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Imports/NoImports/expected_mapping.json (100%) create mode 100644 tests/Imports/NoImports/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Imports/NoImports/expected_representation.txt (100%) rename test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/OneImport/Fake.fs => tests/Imports/OneImport/OneImport.fs (100%) rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Imports/OneImport/expected_mapping.json (100%) create mode 100644 tests/Imports/OneImport/expected_representation.json rename {test/Exercism.Representers.FSharp.IntegrationTests/Solutions => tests}/Imports/OneImport/expected_representation.txt (100%) diff --git a/.dockerignore b/.dockerignore index 05fe1f5..3f8e7a3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,12 +1,5 @@ * -!run.sh -!src/Exercism.Representers.FSharp -src/Exercism.Representers.FSharp/bin -src/Exercism.Representers.FSharp/obj -.appends -.git -.github -.gitignore -.gitattributes -.dockerignore -Dockerfile +!/bin/run.sh +!/src/Exercism.Representers.FSharp +/src/Exercism.Representers.FSharp/bin +/src/Exercism.Representers.FSharp/obj diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9990ac2..57d8e5a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,11 +8,27 @@ on: workflow_dispatch: jobs: - test: - runs-on: ubuntu-18.04 + build: + name: Tests + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - - uses: actions/setup-dotnet@v3.0.3 + - name: Checkout code + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 + with: + install: true + + - name: Build and push + uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 with: - dotnet-version: "3.1.300" - - run: pwsh ./test.ps1 + context: . + push: false + load: true + tags: exercism/fsharp-representer + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Run Tests in Docker + run: bin/run-tests-in-docker.sh diff --git a/.gitignore b/.gitignore index 7d05903..5d3af24 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ .dotnet *.DotSettings.user representation.txt +representation.json mapping.json bin/ obj/ +!/bin diff --git a/Dockerfile b/Dockerfile index 2757004..113a441 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,6 @@ WORKDIR /opt/representer COPY --from=build /opt/representer/ . COPY --from=build /usr/local/bin/ /usr/local/bin/ -COPY run.sh /opt/representer/bin/ +COPY bin/run.sh /opt/representer/bin/ ENTRYPOINT ["sh", "/opt/representer/bin/run.sh"] diff --git a/Exercism.Representers.FSharp.sln b/Exercism.Representers.FSharp.sln index c18ff98..3801479 100644 --- a/Exercism.Representers.FSharp.sln +++ b/Exercism.Representers.FSharp.sln @@ -1,10 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# +# Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Exercism.Representers.FSharp", "src\Exercism.Representers.FSharp\Exercism.Representers.FSharp.fsproj", "{9428D8F1-00A3-4246-85DE-F0D31978D853}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Exercism.Representers.FSharp.IntegrationTests", "test\Exercism.Representers.FSharp.IntegrationTests\Exercism.Representers.FSharp.IntegrationTests.fsproj", "{3AAC4D42-D417-4CB1-A82B-82EC8F73330E}" -EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Exercism.Representers.FSharp.Bulk", "src\Exercism.Representers.FSharp.Bulk\Exercism.Representers.FSharp.Bulk.fsproj", "{93AB5F81-CE6D-47A0-BAB8-8FF66D1F53E2}" EndProject Global @@ -17,10 +15,6 @@ Global {9428D8F1-00A3-4246-85DE-F0D31978D853}.Debug|Any CPU.Build.0 = Debug|Any CPU {9428D8F1-00A3-4246-85DE-F0D31978D853}.Release|Any CPU.ActiveCfg = Release|Any CPU {9428D8F1-00A3-4246-85DE-F0D31978D853}.Release|Any CPU.Build.0 = Release|Any CPU - {3AAC4D42-D417-4CB1-A82B-82EC8F73330E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3AAC4D42-D417-4CB1-A82B-82EC8F73330E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3AAC4D42-D417-4CB1-A82B-82EC8F73330E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3AAC4D42-D417-4CB1-A82B-82EC8F73330E}.Release|Any CPU.Build.0 = Release|Any CPU {93AB5F81-CE6D-47A0-BAB8-8FF66D1F53E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {93AB5F81-CE6D-47A0-BAB8-8FF66D1F53E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {93AB5F81-CE6D-47A0-BAB8-8FF66D1F53E2}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/README.md b/README.md index c3190e5..dfe7b46 100644 --- a/README.md +++ b/README.md @@ -9,37 +9,19 @@ This repository contains the F# representer, which implements the [representer i To create a representation of a solution, follow these steps: 1. Open a command prompt in the root directory. -1. Run `./generate.ps1 `. This script will generate a representation for the solution found in ``. +1. Run `./bin/run.sh `. This script will generate a representation for the solution found in ``. 1. Once the script has completed, the representation will be written to `/representation.txt`. -## Generate a representation for multiple solutions - -To create representations for multiple solutions at once, follow these steps: - -1. Open a command prompt in the root directory. -1. Run `./generate-in-bulk.ps1 `. This script will create a representation for the solution in each directory sub-directory of ``. -1. Once the script has completed, a representation for the solutions will be written in each directory. - ## Generate a representation for a solution using Docker To generate a representation for a solution using a Docker container, follow these steps: 1. Open a command prompt in the root directory. -1. Run `./generate-in-docker.ps1 `. This script will: +1. Run `./bin/run-in-docker.sh `. This script will: 1. Build the representer Docker image (if necessary). 1. Run the representer Docker image (as a container), passing the specified `exercise`, `input-directory` and `output-directory` arguments. 1. Once the script has completed, the representation can be found at `/representation.txt`. -## Source code formatting - -This repository uses the [fantomas][fantomas] and [prettier][prettier] tools to format the source code. There are no custom rules; we just use the default formatting. You can format the code by running the `./format.ps1` command. - -### Scripts - -The scripts in this repository are written in PowerShell. As PowerShell is cross-platform nowadays, you can also install it on [Linux](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6) and [macOS](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-macos?view=powershell-6). - [representer-introduction]: https://github.com/exercism/automated-analysis/blob/master/docs/representers/introduction.md [representer-interface]: https://github.com/exercism/automated-analysis/blob/master/docs/representers/interface.md [fsharp-compiler-services]: https://fsharp.github.io/FSharp.Compiler.Service/ -[fantomas]: https://github.com/fsprojects/fantomas -[prettier]: https://prettier.io/ diff --git a/bin/run-in-docker.sh b/bin/run-in-docker.sh new file mode 100755 index 0000000..aadc50c --- /dev/null +++ b/bin/run-in-docker.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env sh +set -e + +# Synopsis: +# Run the representer on a solution using the representer Docker image. +# The representer Docker image is built automatically. + +# Arguments: +# $1: exercise slug +# $2: path to solution folder +# $3: path to output directory + +# Output: +# Writes the representation to a representation.txt and representation.json file +# in the passed-in output directory. +# The output files are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/representers/interface.md + +# Example: +# ./bin/run-in-docker.sh two-fer path/to/solution/folder/ path/to/output/directory/ + +# If any required arguments is missing, print the usage and exit +if [ "$#" -lt 3 ]; then + echo "usage: ./bin/run-in-docker.sh exercise-slug path/to/solution/folder/ path/to/output/directory/" + exit 1 +fi + +slug="$1" +solution_dir=$(realpath "${2%/}") +output_dir=$(realpath "${3%/}") + +# Create the output directory if it doesn't exist +mkdir -p "${output_dir}" + +# Build the Docker image +docker build --rm -t exercism/csharp-representer . + +# Run the Docker image using the settings mimicking the production environment +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 \ + exercism/csharp-representer "${slug}" /solution /output diff --git a/bin/run-tests-in-docker.sh b/bin/run-tests-in-docker.sh new file mode 100755 index 0000000..cb0c639 --- /dev/null +++ b/bin/run-tests-in-docker.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env sh +set -e + +# Synopsis: +# Test the representer Docker image by running it against a predefined set of +# solutions with an expected output. +# The representer Docker image is built automatically. + +# Output: +# Outputs the diff of the expected representation files against the actual +# representation files generated by the test runner Docker image. + +# Example: +# ./bin/run-tests-in-docker.sh + +# Build the Docker image +docker build --rm -t exercism/fsharp-representer . + +# Run the Docker image using the settings mimicking the production environment +docker run \ + --rm \ + --network none \ + --read-only \ + --mount type=bind,src="${PWD}/tests",dst=/opt/representer/tests \ + --mount type=tmpfs,dst=/tmp \ + --volume "${PWD}/bin/run-tests.sh:/opt/representer/bin/run-tests.sh" \ + --workdir /opt/representer \ + --entrypoint /opt/representer/bin/run-tests.sh \ + exercism/fsharp-representer diff --git a/bin/run-tests.sh b/bin/run-tests.sh new file mode 100755 index 0000000..6def05e --- /dev/null +++ b/bin/run-tests.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env sh + +# Synopsis: +# Test the representer by running it against a predefined set of solutions +# with an expected output. + +# Output: +# Outputs the diff of the expected representation files against the +# actual representation files generated by the test runner. + +# Example: +# ./bin/run-tests.sh + +exit_code=0 +filenames="representation.txt representation.json mapping.json" + +# Iterate over all test directories +for test_dir in tests/*/*; do + test_dir_name=$(basename "${test_dir}") + test_dir_path=$(realpath "${test_dir}") + + bin/run.sh "${test_dir_name}" "${test_dir_path}" "${test_dir_path}" + + for filename in $filenames; do + actual_filepath="${test_dir_path}/${filename}" + expected_filepath="${test_dir_path}/expected_${filename}" + + echo "${test_dir_name}: comparing ${filename} to expected_${filename}" + diff "${actual_filepath}" "${expected_filepath}" + + if [ $? -ne 0 ]; then + exit_code=1 + fi + done +done + +exit ${exit_code} diff --git a/bin/run.sh b/bin/run.sh new file mode 100755 index 0000000..9b5c1aa --- /dev/null +++ b/bin/run.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +# Synopsis: +# Run the representer on a solution. + +# Arguments: +# $1: exercise slug +# $2: path to solution folder +# $3: path to output directory + +# Output: +# Writes the representation to a representation.txt and representation.json file +# in the passed-in output directory. +# The output files are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/representers/interface.md + +# Example: +# ./bin/run.sh two-fer path/to/solution/folder/ path/to/output/directory/ + +# If any required arguments is missing, print the usage and exit +if [ "$#" -lt 3 ]; then + echo "usage: ./bin/run.sh exercise-slug path/to/solution/folder/ path/to/output/directory/" + exit 1 +fi + +export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true +/opt/representer/Exercism.Representers.FSharp $1 $2 $3 diff --git a/config.json b/config.json deleted file mode 100644 index 85deee8..0000000 --- a/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": 2 -} diff --git a/format.ps1 b/format.ps1 deleted file mode 100644 index c596b4b..0000000 --- a/format.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -<# -.SYNOPSIS - Format the source code. -.DESCRIPTION - Formats the .NET source code, as well as all markdown files. -.EXAMPLE - The example below will format all source code - PS C:\> ./format.ps1 -.NOTES - The formatting of markdown files is done through prettier. This means - that NPM has to be installed for this functionality to work. -#> - -dotnet tool restore -dotnet fantomas --recurse src -dotnet fantomas test/Exercism.Representers.FSharp.IntegrationTests/Tests.fs - -npx prettier@1.19.1 --write "**/*.md" \ No newline at end of file diff --git a/generate-in-bulk.ps1 b/generate-in-bulk.ps1 deleted file mode 100644 index ff595ac..0000000 --- a/generate-in-bulk.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -<# -.SYNOPSIS - Bulk generate representations for the solutions in a directory. -.DESCRIPTION - Bulk generate representations for the solutions in a directory. - Each child directory of the specified directory will be assumed to - contain a solution. -.PARAMETER Exercise - The slug of the exercise for which a representation should be generated. -.PARAMETER Directory - The directory in which the solutions can be found. -.EXAMPLE - The example below will generate a representation for the two-fer solutions - in the "~/exercism/two-fer" directory. Note: the representation file will - be written to the solution's directory. - PS C:\> ./generate-in-bulk.ps1 two-fer ~/exercism/two-fer -#> - -param ( - [Parameter(Position = 0, Mandatory = $true)] - [string]$Exercise, - - [Parameter(Position = 1, Mandatory = $true)] - [string]$Directory -) - -dotnet run --project ./src/Exercism.Representers.FSharp.Bulk/ $Exercise $Directory \ No newline at end of file diff --git a/generate-in-docker.ps1 b/generate-in-docker.ps1 deleted file mode 100644 index d29c144..0000000 --- a/generate-in-docker.ps1 +++ /dev/null @@ -1,33 +0,0 @@ -<# -.SYNOPSIS - Generate a representation for a solution using the Docker representer image. -.DESCRIPTION - Solutions on the website are stored in a normalized, representation format - using the Docker representer image. - This script allows one to verify that this Docker image correctly - generates a valid representation of a solution. -.PARAMETER Exercise - The slug of the exercise for which a representation should be generated. -.PARAMETER InputDirectory - The directory in which the solution can be found. -.PARAMETER OutputDirectory - The directory to which the representation file will be written. -.EXAMPLE - The example below will generate a representation for the two-fer solution - in the "~/exercism/two-fer" directory and write the results to "~/exercism/results/" - PS C:\> ./generate-in-docker.ps1 two-fer ~/exercism/two-fer ~/exercism/results/ -#> - -param ( - [Parameter(Position = 0, Mandatory = $true)] - [string]$Exercise, - - [Parameter(Position = 1, Mandatory = $true)] - [string]$InputDirectory, - - [Parameter(Position = 2, Mandatory = $true)] - [string]$OutputDirectory -) - -docker build -t exercism/fsharp-representer . -docker run -v ${InputDirectory}:/input -v ${OutputDirectory}:/output exercism/fsharp-representer $Exercise /input /output \ No newline at end of file diff --git a/generate.ps1 b/generate.ps1 deleted file mode 100644 index 78d3023..0000000 --- a/generate.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -<# -.SYNOPSIS - Generate a representation for a solution. -.DESCRIPTION - Generate a representation for a solution. -.PARAMETER Slug - The slug of the exercise for which a representation should be generated. -.PARAMETER InputDirectory - The directory in which the solution can be found. -.PARAMETER OutputDirectory - The directory to which the representation file will be written. -.EXAMPLE - The example below will generate a representation for the two-fer solution - in the "~/exercism/two-fer" directory and write the results to "~/exercism/results/" - PS C:\> ./generate.ps1 two-fer ~/exercism/two-fer ~/exercism/results/ -#> - -param ( - [Parameter(Position = 0, Mandatory = $true)] - [string]$Exercise, - - [Parameter(Position = 1, Mandatory = $true)] - [string]$InputDirectory, - - [Parameter(Position = 2, Mandatory = $true)] - [string]$OutputDirectory -) - -dotnet run --project ./src/Exercism.Representers.FSharp/ $Exercise $InputDirectory $OutputDirectory \ No newline at end of file diff --git a/run.sh b/run.sh deleted file mode 100644 index db4e5a2..0000000 --- a/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true -/opt/representer/Exercism.Representers.FSharp $1 $2 $3 \ No newline at end of file diff --git a/test.ps1 b/test.ps1 deleted file mode 100644 index 3887db5..0000000 --- a/test.ps1 +++ /dev/null @@ -1,53 +0,0 @@ -<# -.SYNOPSIS - Run all tests. -.DESCRIPTION - Run all tests, verifying the behavior of the analyzer. -.PARAMETER UpdateExpected - Update the expected representation files to the current output (optional). -.EXAMPLE - The example below will run all tests - PS C:\> ./test.ps1 - - The example below will run all tests and update the expected representation files - PS C:\> ./test.ps1 -UpdateExpected -.NOTES - The UpdateExpected switch should only be used if a bulk update of the expected - representation files is needed. -#> - -param ( - [Parameter(Mandatory = $false)] - [Switch]$UpdateExpected -) - -function Update-Expected { - $solutionsDir = Join-Path "test" -ChildPath "Exercism.Representers.FSharp.IntegrationTests" | Join-Path -ChildPath "Solutions" - Generate-Solution-Representations $solutionsDir - Move-Generated-Represenations-To-Expected - Move-Generated-Mappings-To-Expected -} - -function Generate-Solution-Representations ([string] $SolutionsDir) { - ./generate-in-bulk.ps1 "fake" $solutionsDir -} - -function Move-Generated-Represenations-To-Expected ([string] $SolutionsDir) { - Get-ChildItem $solutionsDir "representation.txt" -Recurse | ForEach-Object { - Move-Item -Force $_.FullName $_.FullName.Replace("representation", "expected_representation") - } -} - -function Move-Generated-Mappings-To-Expected ([string] $SolutionsDir) { - Get-ChildItem $solutionsDir "mapping.json" -Recurse | ForEach-Object { - Move-Item -Force $_.FullName $_.FullName.Replace("mapping", "expected_mapping") - } -} - -if ($UpdateExpected.IsPresent) { - Update-Expected -} - -dotnet test - -exit $LastExitCode diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Exercism.Representers.FSharp.IntegrationTests.fsproj b/test/Exercism.Representers.FSharp.IntegrationTests/Exercism.Representers.FSharp.IntegrationTests.fsproj deleted file mode 100644 index 05c2094..0000000 --- a/test/Exercism.Representers.FSharp.IntegrationTests/Exercism.Representers.FSharp.IntegrationTests.fsproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - net6.0 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Tests.fs b/test/Exercism.Representers.FSharp.IntegrationTests/Tests.fs deleted file mode 100644 index 229d67c..0000000 --- a/test/Exercism.Representers.FSharp.IntegrationTests/Tests.fs +++ /dev/null @@ -1,52 +0,0 @@ -module Tests - -open System.Collections.Generic -open Xunit -open Xunit.Sdk -open System.IO -open System.Text.Json - -type SolutionDirectoriesDataAttribute() = - inherit DataAttribute() - - override _.GetData(_) = - Directory.GetDirectories("Solutions") - |> Seq.collect Directory.GetDirectories - |> Seq.map (fun dir -> [| dir |]) - -type AssertionData = - { Expected: string - Actual: string } - -let private normalizeWhitespace (str: string) = str.Replace("\r\n", "\n").Trim() - -let private readMapping (directory: string) = - let readFile fileName = - File.ReadAllText(Path.Combine(directory, fileName)) - |> JsonSerializer.Deserialize> - |> JsonSerializer.Serialize - |> normalizeWhitespace - - { Expected = readFile "expected_mapping.json" - Actual = readFile "mapping.json" } - -let private readRepresentation (directory: string) = - let readFile fileName = File.ReadAllText(Path.Combine(directory, fileName)) |> normalizeWhitespace - - { Expected = readFile "expected_representation.txt" - Actual = readFile "representation.txt" } - -let private runRepresenter (directory: string) = - let argv = [| "fake"; directory; directory |] - Exercism.Representers.FSharp.Program.main argv - -[] -[] -let ``Solution is represented correctly`` (directory: string) = - runRepresenter directory |> ignore - - let representation = readRepresentation directory - let mapping = readMapping directory - - Assert.Equal(representation.Expected, representation.Actual) - Assert.Equal(mapping.Expected, mapping.Actual) diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForEntireLines/Fake.fs b/tests/Comments/MultiLineCommentForEntireLines/MultiLineCommentForEntireLines.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForEntireLines/Fake.fs rename to tests/Comments/MultiLineCommentForEntireLines/MultiLineCommentForEntireLines.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForEntireLines/expected_mapping.json b/tests/Comments/MultiLineCommentForEntireLines/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForEntireLines/expected_mapping.json rename to tests/Comments/MultiLineCommentForEntireLines/expected_mapping.json diff --git a/tests/Comments/MultiLineCommentForEntireLines/expected_representation.json b/tests/Comments/MultiLineCommentForEntireLines/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Comments/MultiLineCommentForEntireLines/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForEntireLines/expected_representation.txt b/tests/Comments/MultiLineCommentForEntireLines/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForEntireLines/expected_representation.txt rename to tests/Comments/MultiLineCommentForEntireLines/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForPartOfLine/Fake.fs b/tests/Comments/MultiLineCommentForPartOfLine/MultiLineCommentForPartOfLine.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForPartOfLine/Fake.fs rename to tests/Comments/MultiLineCommentForPartOfLine/MultiLineCommentForPartOfLine.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForPartOfLine/expected_mapping.json b/tests/Comments/MultiLineCommentForPartOfLine/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForPartOfLine/expected_mapping.json rename to tests/Comments/MultiLineCommentForPartOfLine/expected_mapping.json diff --git a/tests/Comments/MultiLineCommentForPartOfLine/expected_representation.json b/tests/Comments/MultiLineCommentForPartOfLine/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Comments/MultiLineCommentForPartOfLine/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForPartOfLine/expected_representation.txt b/tests/Comments/MultiLineCommentForPartOfLine/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/MultiLineCommentForPartOfLine/expected_representation.txt rename to tests/Comments/MultiLineCommentForPartOfLine/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForEntireLine/Fake.fs b/tests/Comments/SingleLineCommentForEntireLine/SingleLineCommentForEntireLine.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForEntireLine/Fake.fs rename to tests/Comments/SingleLineCommentForEntireLine/SingleLineCommentForEntireLine.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForEntireLine/expected_mapping.json b/tests/Comments/SingleLineCommentForEntireLine/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForEntireLine/expected_mapping.json rename to tests/Comments/SingleLineCommentForEntireLine/expected_mapping.json diff --git a/tests/Comments/SingleLineCommentForEntireLine/expected_representation.json b/tests/Comments/SingleLineCommentForEntireLine/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Comments/SingleLineCommentForEntireLine/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForEntireLine/expected_representation.txt b/tests/Comments/SingleLineCommentForEntireLine/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForEntireLine/expected_representation.txt rename to tests/Comments/SingleLineCommentForEntireLine/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForPartOfLine/Fake.fs b/tests/Comments/SingleLineCommentForPartOfLine/SingleLineCommentForPartOfLine.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForPartOfLine/Fake.fs rename to tests/Comments/SingleLineCommentForPartOfLine/SingleLineCommentForPartOfLine.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForPartOfLine/expected_mapping.json b/tests/Comments/SingleLineCommentForPartOfLine/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForPartOfLine/expected_mapping.json rename to tests/Comments/SingleLineCommentForPartOfLine/expected_mapping.json diff --git a/tests/Comments/SingleLineCommentForPartOfLine/expected_representation.json b/tests/Comments/SingleLineCommentForPartOfLine/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Comments/SingleLineCommentForPartOfLine/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForPartOfLine/expected_representation.txt b/tests/Comments/SingleLineCommentForPartOfLine/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/SingleLineCommentForPartOfLine/expected_representation.txt rename to tests/Comments/SingleLineCommentForPartOfLine/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/XmlComment/Fake.fs b/tests/Comments/XmlComment/XmlComment.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/XmlComment/Fake.fs rename to tests/Comments/XmlComment/XmlComment.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/XmlComment/expected_mapping.json b/tests/Comments/XmlComment/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/XmlComment/expected_mapping.json rename to tests/Comments/XmlComment/expected_mapping.json diff --git a/tests/Comments/XmlComment/expected_representation.json b/tests/Comments/XmlComment/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Comments/XmlComment/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/XmlComment/expected_representation.txt b/tests/Comments/XmlComment/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Comments/XmlComment/expected_representation.txt rename to tests/Comments/XmlComment/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/IfElseOnSeparateLines/Fake.fs b/tests/Formatting/IfElseOnSeparateLines/IfElseOnSeparateLines.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/IfElseOnSeparateLines/Fake.fs rename to tests/Formatting/IfElseOnSeparateLines/IfElseOnSeparateLines.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/IfElseOnSeparateLines/expected_mapping.json b/tests/Formatting/IfElseOnSeparateLines/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/IfElseOnSeparateLines/expected_mapping.json rename to tests/Formatting/IfElseOnSeparateLines/expected_mapping.json diff --git a/tests/Formatting/IfElseOnSeparateLines/expected_representation.json b/tests/Formatting/IfElseOnSeparateLines/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Formatting/IfElseOnSeparateLines/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/IfElseOnSeparateLines/expected_representation.txt b/tests/Formatting/IfElseOnSeparateLines/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/IfElseOnSeparateLines/expected_representation.txt rename to tests/Formatting/IfElseOnSeparateLines/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/InconsistentWhiteSpace/Fake.fs b/tests/Formatting/InconsistentWhiteSpace/InconsistentWhiteSpace.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/InconsistentWhiteSpace/Fake.fs rename to tests/Formatting/InconsistentWhiteSpace/InconsistentWhiteSpace.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/InconsistentWhiteSpace/expected_mapping.json b/tests/Formatting/InconsistentWhiteSpace/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/InconsistentWhiteSpace/expected_mapping.json rename to tests/Formatting/InconsistentWhiteSpace/expected_mapping.json diff --git a/tests/Formatting/InconsistentWhiteSpace/expected_representation.json b/tests/Formatting/InconsistentWhiteSpace/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Formatting/InconsistentWhiteSpace/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/InconsistentWhiteSpace/expected_representation.txt b/tests/Formatting/InconsistentWhiteSpace/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/InconsistentWhiteSpace/expected_representation.txt rename to tests/Formatting/InconsistentWhiteSpace/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/Lists/Fake.fs b/tests/Formatting/Lists/Lists.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/Lists/Fake.fs rename to tests/Formatting/Lists/Lists.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/Lists/expected_mapping.json b/tests/Formatting/Lists/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/Lists/expected_mapping.json rename to tests/Formatting/Lists/expected_mapping.json diff --git a/tests/Formatting/Lists/expected_representation.json b/tests/Formatting/Lists/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Formatting/Lists/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/Lists/expected_representation.txt b/tests/Formatting/Lists/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/Lists/expected_representation.txt rename to tests/Formatting/Lists/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/TypeDefinitionNotIndented/Fake.fs b/tests/Formatting/TypeDefinitionNotIndented/TypeDefinitionNotIndented.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/TypeDefinitionNotIndented/Fake.fs rename to tests/Formatting/TypeDefinitionNotIndented/TypeDefinitionNotIndented.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/TypeDefinitionNotIndented/expected_mapping.json b/tests/Formatting/TypeDefinitionNotIndented/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/TypeDefinitionNotIndented/expected_mapping.json rename to tests/Formatting/TypeDefinitionNotIndented/expected_mapping.json diff --git a/tests/Formatting/TypeDefinitionNotIndented/expected_representation.json b/tests/Formatting/TypeDefinitionNotIndented/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Formatting/TypeDefinitionNotIndented/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/TypeDefinitionNotIndented/expected_representation.txt b/tests/Formatting/TypeDefinitionNotIndented/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Formatting/TypeDefinitionNotIndented/expected_representation.txt rename to tests/Formatting/TypeDefinitionNotIndented/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Bindings/Fake.fs b/tests/Identifiers/Bindings/Bindings.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Bindings/Fake.fs rename to tests/Identifiers/Bindings/Bindings.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Bindings/expected_mapping.json b/tests/Identifiers/Bindings/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Bindings/expected_mapping.json rename to tests/Identifiers/Bindings/expected_mapping.json diff --git a/tests/Identifiers/Bindings/expected_representation.json b/tests/Identifiers/Bindings/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Identifiers/Bindings/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Bindings/expected_representation.txt b/tests/Identifiers/Bindings/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Bindings/expected_representation.txt rename to tests/Identifiers/Bindings/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Functions/Fake.fs b/tests/Identifiers/Functions/Functions.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Functions/Fake.fs rename to tests/Identifiers/Functions/Functions.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Functions/expected_mapping.json b/tests/Identifiers/Functions/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Functions/expected_mapping.json rename to tests/Identifiers/Functions/expected_mapping.json diff --git a/tests/Identifiers/Functions/expected_representation.json b/tests/Identifiers/Functions/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Identifiers/Functions/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Functions/expected_representation.txt b/tests/Identifiers/Functions/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Functions/expected_representation.txt rename to tests/Identifiers/Functions/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Lambdas/Fake.fs b/tests/Identifiers/Lambdas/Lambdas.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Lambdas/Fake.fs rename to tests/Identifiers/Lambdas/Lambdas.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Lambdas/expected_mapping.json b/tests/Identifiers/Lambdas/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Lambdas/expected_mapping.json rename to tests/Identifiers/Lambdas/expected_mapping.json diff --git a/tests/Identifiers/Lambdas/expected_representation.json b/tests/Identifiers/Lambdas/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Identifiers/Lambdas/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Lambdas/expected_representation.txt b/tests/Identifiers/Lambdas/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/Lambdas/expected_representation.txt rename to tests/Identifiers/Lambdas/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/NestedFunctionsAndBindings/Fake.fs b/tests/Identifiers/NestedFunctionsAndBindings/NestedFunctionsAndBindings.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/NestedFunctionsAndBindings/Fake.fs rename to tests/Identifiers/NestedFunctionsAndBindings/NestedFunctionsAndBindings.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/NestedFunctionsAndBindings/expected_mapping.json b/tests/Identifiers/NestedFunctionsAndBindings/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/NestedFunctionsAndBindings/expected_mapping.json rename to tests/Identifiers/NestedFunctionsAndBindings/expected_mapping.json diff --git a/tests/Identifiers/NestedFunctionsAndBindings/expected_representation.json b/tests/Identifiers/NestedFunctionsAndBindings/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Identifiers/NestedFunctionsAndBindings/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/NestedFunctionsAndBindings/expected_representation.txt b/tests/Identifiers/NestedFunctionsAndBindings/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Identifiers/NestedFunctionsAndBindings/expected_representation.txt rename to tests/Identifiers/NestedFunctionsAndBindings/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/MultipleImports/Fake.fs b/tests/Imports/MultipleImports/MultipleImports.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/MultipleImports/Fake.fs rename to tests/Imports/MultipleImports/MultipleImports.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/MultipleImports/expected_mapping.json b/tests/Imports/MultipleImports/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/MultipleImports/expected_mapping.json rename to tests/Imports/MultipleImports/expected_mapping.json diff --git a/tests/Imports/MultipleImports/expected_representation.json b/tests/Imports/MultipleImports/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Imports/MultipleImports/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/MultipleImports/expected_representation.txt b/tests/Imports/MultipleImports/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/MultipleImports/expected_representation.txt rename to tests/Imports/MultipleImports/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/NoImports/Fake.fs b/tests/Imports/NoImports/NoImports.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/NoImports/Fake.fs rename to tests/Imports/NoImports/NoImports.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/NoImports/expected_mapping.json b/tests/Imports/NoImports/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/NoImports/expected_mapping.json rename to tests/Imports/NoImports/expected_mapping.json diff --git a/tests/Imports/NoImports/expected_representation.json b/tests/Imports/NoImports/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Imports/NoImports/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/NoImports/expected_representation.txt b/tests/Imports/NoImports/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/NoImports/expected_representation.txt rename to tests/Imports/NoImports/expected_representation.txt diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/OneImport/Fake.fs b/tests/Imports/OneImport/OneImport.fs similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/OneImport/Fake.fs rename to tests/Imports/OneImport/OneImport.fs diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/OneImport/expected_mapping.json b/tests/Imports/OneImport/expected_mapping.json similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/OneImport/expected_mapping.json rename to tests/Imports/OneImport/expected_mapping.json diff --git a/tests/Imports/OneImport/expected_representation.json b/tests/Imports/OneImport/expected_representation.json new file mode 100644 index 0000000..218abba --- /dev/null +++ b/tests/Imports/OneImport/expected_representation.json @@ -0,0 +1 @@ +{"version":2} \ No newline at end of file diff --git a/test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/OneImport/expected_representation.txt b/tests/Imports/OneImport/expected_representation.txt similarity index 100% rename from test/Exercism.Representers.FSharp.IntegrationTests/Solutions/Imports/OneImport/expected_representation.txt rename to tests/Imports/OneImport/expected_representation.txt