a8m / a8m/expect

Matcher for reading from channels

Aperta
#21 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
30
Fork
4
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Often we are asserting on reading from a channel. It would be useful to have one that could read from channel and make further assertions on the result.

e.g.

```go
c := make(chan int, 100)
// ...
expect(c).To.Receive().And.Equal(90)
```

This example has more than just the `Receive` functionality. It also includes some chaining. If is distasteful, then maybe the following would be more palatable:

```go
c := make(chan int, 100)
// ...
expect(c).To.Receive(&i).Else.FailNow()
expect(i).To.Equal(90)
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.