iterators3 tests dont check if errors are returned correctly
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- rust
- 领域
- testing-qa
调研方向
从 exercises/18_iterators/iterators3.rs 及其现有测试开始;将其中的断言与 issue 中描述的过滤解决方案进行比较。更新练习或其测试输入,使丢弃 Err 变体的实现失败,并验证预期的 Result 行为已得到覆盖。
由索引模型根据 Issue 内容生成。
描述
I'm currently doing rustlings and struggled with iterators3 and searched a solution, which i thought i found here.
It implements one of the functions to edit like this:
fn result_with_list() -> Result<Vec<i64>, DivisionError> {
let numbers = vec![27, 297, 38502, 81];
let division_results = numbers.into_iter().map(|n| divide(n, 27));
division_results.filter(|x| x.is_ok()).collect()
}
which compiles and passes the implemented test but this didn't make any sense to me, as this can never return a correct Err variant, at "best" this would return and empty Vec<i64>, if every division returns an Err variant, which is, as far as i understand, not the intended solution.
To remedy this, I would suggest adding test cases to cover this wrong solution, but since the functions that get tested here don't take any parameters, but instead have hard-coded values inside them, this would require changing their signature and passing in the vector of numbers to be divided.
I'm new to rust, so please let me know if this isn't a real issue.
If this is indeed a real issue, I'm happy to suggest an updated version of this exercise.
- 主要语言
- Rust
- 星标
- 64.8k
- 派生
- 11.3k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rust-lang/rustlings 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
-
A-exercises C-enhancement P-low
难度 1/5 1 小时以内 新手友好度 76/100
-
难度 3/5 1-2 天 新手友好度 55/100
-
Proposal: German (Deutsch) translation for Community Exercises可能重新可做 @mo8it 于 82 天前认领,目前没有进行中的 PR。 未关闭
-
难度 5/5 一周以上 新手友好度 35/100
查看 rust-lang/rustlings 的全部 Issue
相似的 Issue
-
bug good first issue web
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
triage: not actionable
难度 2/5 1-3 小时 新手友好度 66/100
oxc-project/oxc#30518 · 1 条评论 ·
维护者通常 1 天内回复
-
area: panel
难度 2/5 1-3 小时 新手友好度 68/100
frandev94/shattered-islands#98 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复