generated from vrchat-community/template-package
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into avatar_root_utils
- Loading branch information
Showing
23 changed files
with
192 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using nadena.dev.ndmf; | ||
using NUnit.Framework; | ||
using PlasticPipe.PlasticProtocol.Messages; | ||
|
||
namespace UnitTests.PluginResolverTests | ||
{ | ||
class PluginA : Plugin<PluginA> | ||
{ | ||
protected override void Configure() | ||
{ | ||
InPhase(BuildPhase.Generating) | ||
.AfterPlugin<PluginB>() | ||
.Run("PluginA", _ctx => { }); | ||
} | ||
} | ||
|
||
class PluginB : Plugin<PluginB> | ||
{ | ||
protected override void Configure() | ||
{ | ||
InPhase(BuildPhase.Generating) | ||
.Run("PluginB", _ctx => { }); | ||
} | ||
} | ||
|
||
class PluginC : Plugin<PluginC> | ||
{ | ||
protected override void Configure() | ||
{ | ||
InPhase(BuildPhase.Generating) | ||
.BeforePlugin<PluginB>() | ||
.Run("PluginC", _ctx => { }); | ||
} | ||
} | ||
|
||
public class BeforeAfterPlugin | ||
{ | ||
[Test] | ||
public void TestBeforeAfterPluginConstraints() | ||
{ | ||
var resolver = new PluginResolver(new IPlugin[] | ||
{ | ||
PluginA.Instance, PluginB.Instance, PluginC.Instance | ||
}); | ||
var passNames = resolver.Passes.SelectMany(kv => kv.Item2) | ||
.Select(pass => pass.Description) | ||
.ToImmutableList(); | ||
|
||
var wantedPassNames = ImmutableList.Create("PluginC", "PluginB", "PluginA"); | ||
|
||
Assert.That(passNames, Is.EqualTo(wantedPassNames)); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
UnitTests~/PluginResolverTests/SupportsMultipleDeclarations.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using nadena.dev.ndmf; | ||
using NUnit.Framework; | ||
using UnitTests.ExportsPluginTest; | ||
|
||
[assembly: ExportsPlugin(typeof(PluginA))] | ||
[assembly: ExportsPlugin(typeof(PluginB))] | ||
|
||
namespace UnitTests.ExportsPluginTest | ||
{ | ||
internal class PluginA : Plugin<PluginA> | ||
{ | ||
protected override void Configure() | ||
{ | ||
InPhase(BuildPhase.Transforming).Run("test", _ctx => { }); | ||
} | ||
} | ||
|
||
internal class PluginB : Plugin<PluginB> | ||
{ | ||
protected override void Configure() | ||
{ | ||
InPhase(BuildPhase.Transforming).Run("test", _ctx => { }); | ||
} | ||
} | ||
|
||
public class SupportsMultipleDeclarations | ||
{ | ||
[Test] | ||
public void TestSupportsMultipleDeclarations() | ||
{ | ||
var resolver = new PluginResolver(); | ||
var plugins = | ||
resolver.Passes.SelectMany(kv => kv.Item2) // passes per phase | ||
.Select(pass => pass.Plugin.GetType()) | ||
.ToImmutableHashSet(); | ||
|
||
Assert.IsTrue(plugins.Contains(typeof(PluginA))); | ||
Assert.IsTrue(plugins.Contains(typeof(PluginB))); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
UnitTests~/PluginResolverTests/SupportsMultipleDeclarations.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters