From e7e3b5007b654033d4b92d47f5ddddba9015d51c Mon Sep 17 00:00:00 2001 From: Saxon Date: Tue, 12 Mar 2019 16:28:30 +1030 Subject: [PATCH] revid: added test for newMultiSender --- revid/senders_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/revid/senders_test.go b/revid/senders_test.go index a5478899..15af7a1d 100644 --- a/revid/senders_test.go +++ b/revid/senders_test.go @@ -249,3 +249,19 @@ func TestMtsSenderDiscontinuity(t *testing.T) { t.Fatalf("Did not get discontinuity indicator for PAT") } } + +// TestNewMultiSender checks that newMultiSender performs as expected when an +// active function is not provided, and when an active function is provided. +func TestNewMultiSender(t *testing.T) { + // First test without giving an 'active' function. + _, err := newMultiSender(nil, false, nil) + if err == nil { + t.Error("did not get expected error on creation of multiSender without active function") + } + + // Now test with providing an active function + _, err = newMultiSender(nil, false, func() bool { return true }) + if err != nil { + t.Errorf("did not expect to get error on creation of multiSender with active func provided, err: %v", err) + } +}