Matcher for reading from channels
- Ngôn ngữ chính
- Go
- Star
- 30
- Fork
- 4
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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)
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- go
- Lĩnh vực
- testing
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100