From 14adf8e594ace73089d0e545651056aacd0bd97c Mon Sep 17 00:00:00 2001 From: Gavin Norman Date: Wed, 8 Aug 2018 12:05:25 +0200 Subject: [PATCH] Adapt Neo/Node unittests to actually instantiate node class This tests that all expected base class and interface methods are implemented, not merely that the code is syntactically correct. --- src/swarm/node/model/NeoNode.d | 20 +++++++++++++++++++- src/swarm/node/model/Node.d | 15 ++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/swarm/node/model/NeoNode.d b/src/swarm/node/model/NeoNode.d index 67348677..ab85d5b4 100644 --- a/src/swarm/node/model/NeoNode.d +++ b/src/swarm/node/model/NeoNode.d @@ -1068,9 +1068,27 @@ version (UnitTest) } override protected void handleCommand () {} } + + private class TestNode : NodeBase!(TestConnectionHandler) + { + public this ( ) + { + super(NodeItem("127.0.0.1".dup, 2323), new ConnectionSetupParams, 1); + } + + protected override cstring id ( ) + { + return "test"; + } + + protected override void getResourceAcquirer ( + void delegate ( Object resource_acquirer ) handle_request_dg ) + { + } + } } unittest { - alias NodeBase!(TestConnectionHandler) Instance; + auto node = new TestNode; } diff --git a/src/swarm/node/model/Node.d b/src/swarm/node/model/Node.d index 5f56e146..b99d87e7 100644 --- a/src/swarm/node/model/Node.d +++ b/src/swarm/node/model/Node.d @@ -698,9 +698,22 @@ version (UnitTest) } override protected void handleCommand () {} } + + private class TestNode : NodeBase!(TestConnectionHandler) + { + public this ( ) + { + super(NodeItem("127.0.0.1".dup, 2323), new ConnectionSetupParams, 1); + } + + protected override cstring id ( ) + { + return "test"; + } + } } unittest { - alias NodeBase!(TestConnectionHandler) Instance; + auto node = new TestNode; }