NetworkServerTests: UpdateWithNullEntryInSpawned

This commit is contained in:
vis2k 2020-11-13 20:05:08 +01:00
parent 0f96e8ce6b
commit d21d501bd0

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Mirror.RemoteCalls;
using NUnit.Framework;
using UnityEngine;
@ -1190,5 +1191,24 @@ public void NoConnectionsTest_WithHostAndConnection()
NetworkServer.connections.Clear();
NetworkServer.RemoveLocalConnection();
}
// updating NetworkServer with a null entry in NetworkIdentity.spawned
// should log a warning.
[Test]
public void UpdateWithNullEntryInSpawned()
{
// start
NetworkServer.Listen(1);
// add null
NetworkIdentity.spawned[42] = null;
// update
LogAssert.Expect(LogType.Warning, new Regex("Found 'null' entry in spawned list.*"));
NetworkServer.Update();
// clean up
NetworkServer.Shutdown();
}
}
}