nanomsg.org/go/mangos/v2@v2.0.9-0.20200203084354-8a092611e461/protocol/pull/pull_test.go (about)

     1  // Copyright 2019 The Mangos Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use file except in compliance with the License.
     5  // You may obtain a copy of the license at
     6  //
     7  //    http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package pull
    16  
    17  import (
    18  	"nanomsg.org/go/mangos/v2"
    19  	"testing"
    20  
    21  	. "nanomsg.org/go/mangos/v2/internal/test"
    22  )
    23  
    24  func TestPullIdentity(t *testing.T) {
    25  	s := GetSocket(t, NewSocket)
    26  	id := s.Info()
    27  	MustBeTrue(t, id.Self == mangos.ProtoPull)
    28  	MustBeTrue(t, id.SelfName == "pull")
    29  	MustBeTrue(t, id.Peer == mangos.ProtoPush)
    30  	MustBeTrue(t, id.PeerName == "push")
    31  	MustSucceed(t, s.Close())
    32  }
    33  
    34  func TestPullCooked(t *testing.T) {
    35  	VerifyCooked(t, NewSocket)
    36  }
    37  
    38  func TestPullNoContext(t *testing.T) {
    39  	s := GetSocket(t, NewSocket)
    40  	_, e := s.OpenContext()
    41  	MustBeError(t, e, mangos.ErrProtoOp)
    42  	MustSucceed(t, s.Close())
    43  }
    44  
    45  func TestPullOptions(t *testing.T) {
    46  	VerifyInvalidOption(t, NewSocket)
    47  }