Files
Il2CppInspectorRedux/Il2CppTests/generate-tests.ps1
2021-01-04 05:26:43 +01:00

47 lines
997 B
PowerShell

# Copyright 2019-2021 Katy Coe - http://www.djkaty.com - https://github.com/djkaty
# All rights reserved.
# Generate Tests.cs
$testGen = "$PSScriptRoot/Tests.cs"
$bin = "$PSScriptRoot/TestBinaries"
echo @"
// THIS FILE IS AUTO-GENERATED BY GENERATE-TESTS.PS1
// DO NOT EDIT
using System.Threading.Tasks;
using NUnit.Framework;
namespace Il2CppInspector
{
[Parallelizable(ParallelScope.All)]
public partial class TestRunner
{
"@ > $testGen
gci -Directory $bin | % {
$loadOptionsFile = "$($_.FullName)\loadoptions.txt"
$loadOptions = ""
if (Test-Path $loadOptionsFile -PathType Leaf) {
$loadOptions = cat $loadOptionsFile
}
$pluginsPath = "$($_.FullName)\plugins"
$attributes = ""
if (Test-Path $pluginsPath -PathType Container) {
$attributes = "[NonParallelizable]"
}
echo @"
[Test]
$attributes
public async Task $($_.Name -Replace '\W','_')() {
await runTest(@"$($_.FullName)", new LoadOptions { $loadOptions });
}
"@ >> $testGen
}
echo @"
}
}
"@ >> $testGen