Update StaticFieldValidationTest (#34287)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Reflection;
|
using Robust.Shared.Reflection;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -29,7 +30,9 @@ public sealed class StaticFieldValidationTest
|
|||||||
Assert.That(protoMan.ValidateStaticFields(typeof(StringValid), protos), Is.Empty);
|
Assert.That(protoMan.ValidateStaticFields(typeof(StringValid), protos), Is.Empty);
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(StringArrayValid), protos), Is.Empty);
|
Assert.That(protoMan.ValidateStaticFields(typeof(StringArrayValid), protos), Is.Empty);
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdValid), protos), Is.Empty);
|
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdValid), protos), Is.Empty);
|
||||||
|
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdTValid), protos), Is.Empty);
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdArrayValid), protos), Is.Empty);
|
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdArrayValid), protos), Is.Empty);
|
||||||
|
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdTArrayValid), protos), Is.Empty);
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdTestValid), protos), Is.Empty);
|
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdTestValid), protos), Is.Empty);
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdArrayValid), protos), Is.Empty);
|
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdArrayValid), protos), Is.Empty);
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdListValid), protos), Is.Empty);
|
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdListValid), protos), Is.Empty);
|
||||||
@@ -39,7 +42,9 @@ public sealed class StaticFieldValidationTest
|
|||||||
Assert.That(protoMan.ValidateStaticFields(typeof(StringInvalid), protos), Has.Count.EqualTo(1));
|
Assert.That(protoMan.ValidateStaticFields(typeof(StringInvalid), protos), Has.Count.EqualTo(1));
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(StringArrayInvalid), protos), Has.Count.EqualTo(2));
|
Assert.That(protoMan.ValidateStaticFields(typeof(StringArrayInvalid), protos), Has.Count.EqualTo(2));
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdInvalid), protos), Has.Count.EqualTo(1));
|
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdInvalid), protos), Has.Count.EqualTo(1));
|
||||||
|
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdTInvalid), protos), Has.Count.EqualTo(1));
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdArrayInvalid), protos), Has.Count.EqualTo(2));
|
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdArrayInvalid), protos), Has.Count.EqualTo(2));
|
||||||
|
Assert.That(protoMan.ValidateStaticFields(typeof(EntProtoIdTArrayInvalid), protos), Has.Count.EqualTo(2));
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdTestInvalid), protos), Has.Count.EqualTo(1));
|
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdTestInvalid), protos), Has.Count.EqualTo(1));
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdArrayInvalid), protos), Has.Count.EqualTo(2));
|
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdArrayInvalid), protos), Has.Count.EqualTo(2));
|
||||||
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdListInvalid), protos), Has.Count.EqualTo(2));
|
Assert.That(protoMan.ValidateStaticFields(typeof(ProtoIdListInvalid), protos), Has.Count.EqualTo(2));
|
||||||
@@ -88,24 +93,48 @@ public sealed class StaticFieldValidationTest
|
|||||||
public static EntProtoId Tag = "StaticFieldTestEnt";
|
public static EntProtoId Tag = "StaticFieldTestEnt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Reflect(false)]
|
||||||
|
private sealed class EntProtoIdTValid
|
||||||
|
{
|
||||||
|
public static EntProtoId<TransformComponent> Tag = "StaticFieldTestEnt";
|
||||||
|
}
|
||||||
|
|
||||||
[Reflect(false)]
|
[Reflect(false)]
|
||||||
private sealed class EntProtoIdInvalid
|
private sealed class EntProtoIdInvalid
|
||||||
{
|
{
|
||||||
public static EntProtoId Tag = string.Empty;
|
public static EntProtoId Tag = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Reflect(false)]
|
||||||
|
private sealed class EntProtoIdTInvalid
|
||||||
|
{
|
||||||
|
public static EntProtoId<TransformComponent> Tag = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
[Reflect(false)]
|
[Reflect(false)]
|
||||||
private sealed class EntProtoIdArrayValid
|
private sealed class EntProtoIdArrayValid
|
||||||
{
|
{
|
||||||
public static EntProtoId[] Tag = ["StaticFieldTestEnt", "StaticFieldTestEnt"];
|
public static EntProtoId[] Tag = ["StaticFieldTestEnt", "StaticFieldTestEnt"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Reflect(false)]
|
||||||
|
private sealed class EntProtoIdTArrayValid
|
||||||
|
{
|
||||||
|
public static EntProtoId<TransformComponent>[] Tag = ["StaticFieldTestEnt", "StaticFieldTestEnt"];
|
||||||
|
}
|
||||||
|
|
||||||
[Reflect(false)]
|
[Reflect(false)]
|
||||||
private sealed class EntProtoIdArrayInvalid
|
private sealed class EntProtoIdArrayInvalid
|
||||||
{
|
{
|
||||||
public static EntProtoId[] Tag = [string.Empty, "StaticFieldTestEnt", string.Empty];
|
public static EntProtoId[] Tag = [string.Empty, "StaticFieldTestEnt", string.Empty];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Reflect(false)]
|
||||||
|
private sealed class EntProtoIdTArrayInvalid
|
||||||
|
{
|
||||||
|
public static EntProtoId<TransformComponent>[] Tag = [string.Empty, "StaticFieldTestEnt", string.Empty];
|
||||||
|
}
|
||||||
|
|
||||||
[Reflect(false)]
|
[Reflect(false)]
|
||||||
private sealed class ProtoIdTestValid
|
private sealed class ProtoIdTestValid
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user