github.com/hsfzxjy/dgo/go@v0.2.0/testing_stubs.go (about)

     1  package dgo
     2  
     3  //lint:file-ignore U1000 go:linkname
     4  
     5  func lookupPort(key PortKey) *Port { return portMap.GetByPortKey(key) }
     6  
     7  func isPortGone(key PortKey, isDefault bool) bool {
     8  	portMap.mu.Lock()
     9  	defer portMap.mu.Unlock()
    10  
    11  	_, exists := portMap.key2port[key]
    12  	if !isDefault {
    13  		return !exists
    14  	} else {
    15  		return !exists &&
    16  			(portMap.defaultPort == nil ||
    17  				portMap.defaultPort.key() != key)
    18  	}
    19  }
    20  
    21  func testPostToDartPort(port *Port) bool {
    22  	return port.postInt(0, false)
    23  }
    24  
    25  func testPostToGoPort(port *Port) bool {
    26  	return (&Port{sendPortKey: port.receivePortKey}).postInt(0, false)
    27  }