a8m / a8m/expect

Matcher for reading from channels

オープン
#21 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
30
フォーク
4
PR マージ指標
30日以内にマージされた PR はありません

説明

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)
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Look at the existing matchers in the expect package to understand the pattern. The new matcher likely needs to be added to the matchers directory, handle channel operations, and support chaining or a separate assertion. Check how other matchers integrate with the expectation chain and how they handle failure reporting. Write a test in the test suite to verify the receive functionality works with both buffered and unbuffered channels.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
go
領域
testing
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。