Skip to content

Commit

Permalink
Align testdata contents with xunit-compatible toolchains
Browse files Browse the repository at this point in the history
  • Loading branch information
mengdaming committed Jun 14, 2022
1 parent 9ffe457 commit 2c42e5a
Show file tree
Hide file tree
Showing 20 changed files with 276 additions and 68 deletions.
10 changes: 5 additions & 5 deletions tcr-engine/testdata/cpp/.tcr/language/cpp.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
toolchains:
default: cmake-kata
compatible-with: [cmake, cmake-kata]
compatible-with: [ cmake, cmake-kata ]
source-files:
directories: [src, include]
patterns: ['(?i)^.*\.c(c|pp)?$', '(?i)^.*\.h(h|pp)?$']
directories: [ src, include ]
patterns: [ '(?i)^.*\.c(c|pp)?$', '(?i)^.*\.h(h|pp)?$' ]
test-files:
directories: [test]
patterns: ['(?i)^.*\.c(c|pp)?$', '(?i)^.*\.h(h|pp)?$']
directories: [ test ]
patterns: [ '(?i)^.*\.c(c|pp)?$', '(?i)^.*\.h(h|pp)?$' ]
73 changes: 37 additions & 36 deletions tcr-engine/testdata/cpp/.tcr/toolchain/cmake-kata.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,51 @@
build:
- os: [darwin]
arch: [amd64]
- os: [ darwin ]
arch: [ amd64 ]
command: build/cmake/cmake-macos-universal/CMake.app/Contents/bin/cmake
arguments: [--build, build, --config, Debug]
- os: [darwin]
arch: [arm64]
arguments: [ --build, build, --config, Debug ]
- os: [ darwin ]
arch: [ arm64 ]
command: build/cmake/cmake-macos-universal/CMake.app/Contents/bin/cmake
arguments: [--build, build, --config, Debug]
- os: [linux]
arch: [amd64]
arguments: [ --build, build, --config, Debug ]
- os: [ linux ]
arch: [ amd64 ]
command: build/cmake/cmake-linux-x86_64/bin/cmake
arguments: [--build, build, --config, Debug]
- os: [linux]
arch: [arm64]
arguments: [ --build, build, --config, Debug ]
- os: [ linux ]
arch: [ arm64 ]
command: build/cmake/cmake-linux-aarch64/bin/cmake
arguments: [--build, build, --config, Debug]
- os: [windows]
arch: ["386"]
arguments: [ --build, build, --config, Debug ]
- os: [ windows ]
arch: [ "386" ]
command: build\cmake\cmake-windows-i386\bin\cmake.exe
arguments: [--build, build, --config, Debug]
- os: [windows]
arch: [amd64]
arguments: [ --build, build, --config, Debug ]
- os: [ windows ]
arch: [ amd64 ]
command: build\cmake\cmake-windows-x86_64\bin\cmake.exe
arguments: [--build, build, --config, Debug]
arguments: [ --build, build, --config, Debug ]
test:
- os: [darwin]
arch: [amd64]
- os: [ darwin ]
arch: [ amd64 ]
command: build/cmake/cmake-macos-universal/CMake.app/Contents/bin/ctest
arguments: [--output-on-failure, --test-dir, build, --build-config, Debug]
- os: [darwin]
arch: [arm64]
arguments: [ --output-on-failure, --test-dir, build, --build-config, Debug ]
- os: [ darwin ]
arch: [ arm64 ]
command: build/cmake/cmake-macos-universal/CMake.app/Contents/bin/ctest
arguments: [--output-on-failure, --test-dir, build, --build-config, Debug]
- os: [linux]
arch: [amd64]
arguments: [ --output-on-failure, --test-dir, build, --build-config, Debug ]
- os: [ linux ]
arch: [ amd64 ]
command: build/cmake/cmake-linux-x86_64/bin/ctest
arguments: [--output-on-failure, --test-dir, build, --build-config, Debug]
- os: [linux]
arch: [arm64]
arguments: [ --output-on-failure, --test-dir, build, --build-config, Debug ]
- os: [ linux ]
arch: [ arm64 ]
command: build/cmake/cmake-linux-aarch64/bin/ctest
arguments: [--output-on-failure, --test-dir, build, --build-config, Debug]
- os: [windows]
arch: ["386"]
arguments: [ --output-on-failure, --test-dir, build, --build-config, Debug ]
- os: [ windows ]
arch: [ "386" ]
command: build\cmake\cmake-windows-i386\bin\ctest.exe
arguments: [--output-on-failure, --test-dir, build, --build-config, Debug]
- os: [windows]
arch: [amd64]
arguments: [ --output-on-failure, --test-dir, build, --build-config, Debug ]
- os: [ windows ]
arch: [ amd64 ]
command: build\cmake\cmake-windows-x86_64\bin\ctest.exe
arguments: [--output-on-failure, --test-dir, build, --build-config, Debug]
arguments: [ --output-on-failure, --test-dir, build, --build-config, Debug ]
test-result-dir: build/test-results
13 changes: 7 additions & 6 deletions tcr-engine/testdata/cpp/.tcr/toolchain/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
build:
- os: [darwin, linux, windows]
arch: ["386", amd64, arm64]
- os: [ darwin, linux, windows ]
arch: [ "386", amd64, arm64 ]
command: cmake
arguments: [--build, build, --config, Debug]
arguments: [ --build, build, --config, Debug ]
test:
- os: [darwin, linux, windows]
arch: ["386", amd64, arm64]
- os: [ darwin, linux, windows ]
arch: [ "386", amd64, arm64 ]
command: ctest
arguments: [--output-on-failure, --test-dir, build, --build-config, Debug]
arguments: [ --output-on-failure, --test-dir, build, --build-config, Debug ]
test-result-dir: build
5 changes: 4 additions & 1 deletion tcr-engine/testdata/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ target_link_libraries(Kata-Dummy-test
# ApprovalTests
gtest_main)

add_test(NAME ctest-Kata-Dummy COMMAND Kata-Dummy-test)
add_test(
NAME ctest-Kata-Dummy
COMMAND Kata-Dummy-test --gtest_brief=1 --gtest_output=xml:test-results/Kata-Dummy-test.xml
)

#add_custom_target(Docs
# SOURCES
Expand Down
2 changes: 1 addition & 1 deletion tcr-engine/testdata/cpp/cmake/FindGoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
CPMFindPackage(
NAME googletest
GITHUB_REPOSITORY google/googletest
GIT_TAG master
GIT_TAG main
OPTIONS "INSTALL_GTEST OFF" "gtest_force_shared_crt" "BUILD_GMOCK OFF"
)
4 changes: 4 additions & 0 deletions tcr-engine/testdata/csharp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bin/
obj/
TestResults/
.vs/
9 changes: 9 additions & 0 deletions tcr-engine/testdata/csharp/.tcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
config:
git:
auto-push: true
polling-period: 2s
mob-timer:
duration: 5m0s
tcr:
language: csharp
toolchain: dotnet
9 changes: 9 additions & 0 deletions tcr-engine/testdata/csharp/.tcr/language/csharp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
toolchains:
default: dotnet
compatible-with: [dotnet]
source-files:
directories: [src]
patterns: ['(?i)^.*\.cs(x)?$']
test-files:
directories: [tests]
patterns: ['(?i)^.*\.cs(x)?$']
11 changes: 11 additions & 0 deletions tcr-engine/testdata/csharp/.tcr/toolchain/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build:
- os: [ darwin, linux, windows ]
arch: [ "386", amd64, arm64 ]
command: dotnet
arguments: [ build ]
test:
- os: [ darwin, linux, windows ]
arch: [ "386", amd64, arm64 ]
command: dotnet
arguments: [ test, "--no-build", "--logger=junit" ]
test-result-dir: tests
30 changes: 30 additions & 0 deletions tcr-engine/testdata/csharp/Kata-Dummy.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32210.238
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dummy", "src\Kata\Dummy\Dummy.csproj", "{090717FE-BFA4-4E77-BB17-56BA33844343}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dummy.Test", "tests\Kata\Dummy\Dummy.Test.csproj", "{D0A31C61-B4F2-4219-AB70-BBF0C2574933}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{090717FE-BFA4-4E77-BB17-56BA33844343}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{090717FE-BFA4-4E77-BB17-56BA33844343}.Debug|Any CPU.Build.0 = Debug|Any CPU
{090717FE-BFA4-4E77-BB17-56BA33844343}.Release|Any CPU.ActiveCfg = Release|Any CPU
{090717FE-BFA4-4E77-BB17-56BA33844343}.Release|Any CPU.Build.0 = Release|Any CPU
{D0A31C61-B4F2-4219-AB70-BBF0C2574933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0A31C61-B4F2-4219-AB70-BBF0C2574933}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0A31C61-B4F2-4219-AB70-BBF0C2574933}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0A31C61-B4F2-4219-AB70-BBF0C2574933}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5ED6A81C-B702-4189-88EC-AACB7A38AFBA}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions tcr-engine/testdata/csharp/src/Kata/Dummy/Dummy.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Kata.Dummy</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
31 changes: 31 additions & 0 deletions tcr-engine/testdata/csharp/src/Kata/Dummy/DummyClass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright (c) 2022 Murex
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

namespace Kata.Dummy;

public class DummyClass
{
public int DoSomething()
{
return 0;
}
}
30 changes: 30 additions & 0 deletions tcr-engine/testdata/csharp/tests/Kata/Dummy/Dummy.Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Kata.Dummy</RootNamespace>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="JunitXml.TestLogger" Version="3.0.114" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Kata\Dummy\Dummy.csproj" />
</ItemGroup>

</Project>
53 changes: 53 additions & 0 deletions tcr-engine/testdata/csharp/tests/Kata/Dummy/DummyClassTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
Copyright (c) 2022 Murex
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

using Xunit;

namespace Kata.Dummy;

public class DummyClassTest
{
private readonly DummyClass dummy;

public DummyClassTest()
{
dummy = new DummyClass();
}

[Fact(Skip = "skipped test")]
public void SkippedTest()
{
Assert.Equal(2, dummy.DoSomething());
}

[Fact]
public void PassingTest()
{
Assert.Equal(0, dummy.DoSomething());
}

[Fact]
public void FailingTest()
{
Assert.Equal(1, dummy.DoSomething());
}
}
10 changes: 5 additions & 5 deletions tcr-engine/testdata/go/.tcr/language/go.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
toolchains:
default: go-tools
compatible-with: [go-tools]
compatible-with: [ go-tools, gotestsum ]
source-files:
directories: [.]
patterns: ['(?i)^.*\.go$']
directories: [ . ]
patterns: [ '(?i)^.*\.go$' ]
test-files:
directories: [.]
patterns: ['(?i)^.*_test\.go$']
directories: [ . ]
patterns: [ '(?i)^.*_test\.go$' ]
13 changes: 7 additions & 6 deletions tcr-engine/testdata/go/.tcr/toolchain/go-tools.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
build:
- os: [darwin, linux, windows]
arch: ["386", amd64, arm64]
- os: [ darwin, linux, windows ]
arch: [ "386", amd64, arm64 ]
command: go
arguments: [build, ./...]
arguments: [ build, ./... ]
test:
- os: [darwin, linux, windows]
arch: ["386", amd64, arm64]
- os: [ darwin, linux, windows ]
arch: [ "386", amd64, arm64 ]
command: go
arguments: [test, -v, ./...]
arguments: [ test, -short, ./... ]
test-result-dir: .
11 changes: 11 additions & 0 deletions tcr-engine/testdata/go/.tcr/toolchain/gotestsum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build:
- os: [ darwin, linux, windows ]
arch: [ "386", amd64, arm64 ]
command: go
arguments: [ build, ./... ]
test:
- os: [ darwin, linux, windows ]
arch: [ "386", amd64, arm64 ]
command: gotestsum
arguments: [ "--format", "pkgname", "--junitfile", "_test_results/output.xml", "--", "-short", ./... ]
test-result-dir: _test_results
Loading

0 comments on commit 2c42e5a

Please sign in to comment.