Tests for --file-lines

未关闭
#7,112 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #7146 来自 @tayfuryldz —— 已关闭,未合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust
领域
testing

调研方向

首先阅读现有的格式化测试和 --file-lines 的处理逻辑,然后使用每个源与目标之间的 diff 来识别已格式化的行。当测试验证仅格式化这些行会重现目标,而格式化其他行会在相关情况下重现源时,工作就完成了。

由索引模型根据 Issue 内容生成。

描述

A-test-harness A-test-suite C-discussion

I think the existing formatting tests can be made to work for testing --file-lines.

Basically, what you can do is run diff between source/target, and identify the source lines that get formatted. Then use --file-lines to:

  • only format those lines, check if it produces something identical to target
  • only format lines that aren't those, check if it produces something identical to source

This may cover many of the cases @randomPoison has been finding.

There may be cleverer ways of doing this that cover more cases

主要语言
Rust
星标
7.1k
派生
1.2k
平均合并
1 天 4 小时
30 天内合并 PR
20

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rust-lang/rustfmt 的其他 Issue

查看 rust-lang/rustfmt 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。