a8m / a8m/expect

Matcher for reading from channels

未关闭
#21 0 条评论 0 个 reaction 已指派 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 摘要。