Answer the question
In order to leave comments, you need to log in
How to test in Golang?
Hello!
There is a method for sending data to a channel
func (c *Connection) SendMessage(message []byte) {
c.send <- message
}
Answer the question
In order to leave comments, you need to log in
There is no need to write a unit test for it, because this method is quite trivial.
PS If we still wrote a test for it, we would create a Connection object in the test, initialize a channel for it, and check whether a message is written there by reading the channel.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question