mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
split weaver test files by test class
This commit is contained in:
parent
2b1aefab39
commit
93f7028e0d
@ -20,10 +20,7 @@ public static string OutputDirectory
|
||||
if (guidsFound.Length == 1 && !string.IsNullOrEmpty(guidsFound[0]))
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath(guidsFound[0]);
|
||||
string dir = Path.GetDirectoryName(path);
|
||||
// Path in mirror project
|
||||
//"Assets/Mirror/Tests/Editor/WeaverTests~/";
|
||||
_outputDirectory = Path.Combine(dir, "WeaverTests~/");
|
||||
return Path.GetDirectoryName(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
@ -9,7 +11,9 @@ public abstract class WeaverTestsBuildFromTestName : WeaverTests
|
||||
[SetUp]
|
||||
public void TestSetup()
|
||||
{
|
||||
BuildAndWeaveTestAssembly(TestContext.CurrentContext.Test.Name);
|
||||
string className = TestContext.CurrentContext.Test.ClassName.Split('.').Last();
|
||||
|
||||
BuildAndWeaveTestAssembly(className, TestContext.CurrentContext.Test.Name);
|
||||
}
|
||||
}
|
||||
[TestFixture]
|
||||
@ -32,10 +36,11 @@ void HandleWeaverWarning(string msg)
|
||||
weaverWarnings.Add(msg);
|
||||
}
|
||||
|
||||
protected void BuildAndWeaveTestAssembly(string baseName)
|
||||
protected void BuildAndWeaveTestAssembly(string className, string testName)
|
||||
{
|
||||
WeaverAssembler.OutputFile = baseName + ".dll";
|
||||
WeaverAssembler.AddSourceFiles(new string[] { baseName + ".cs" });
|
||||
string testSourceDirectory = className + "~";
|
||||
WeaverAssembler.OutputFile = Path.Combine(testSourceDirectory, testName + ".dll");
|
||||
WeaverAssembler.AddSourceFiles(new string[] { Path.Combine(testSourceDirectory, testName + ".cs") });
|
||||
WeaverAssembler.Build();
|
||||
|
||||
Assert.That(WeaverAssembler.CompilerErrors, Is.False);
|
||||
|
Loading…
Reference in New Issue
Block a user