test: fix baseline test build#152
Conversation
📝 WalkthroughWalkthroughFive small test-only additions: ChangesTest compilation fixes and Task::to_markdown
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/ui/productivity_panel.rs`:
- Around line 88-98: The format string in the to_markdown method has a literal
space between the checkbox and priority placeholder, which creates a
double-space when priority is empty. Fix this by modifying the format string and
priority handling so that a space only appears before the priority when the
priority string is not empty. One approach is to conditionally build the
priority string with a leading space only when priority is not an empty string,
or restructure the format arguments to eliminate the extra space.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8ddcdab4-c159-46b3-a081-f134364808a1
📒 Files selected for processing (5)
src/editor/ferrite/history.rssrc/markdown/code_execution.rssrc/markdown/mermaid/flowchart/mod.rssrc/markdown/mermaid/flowchart/render/edges.rssrc/ui/productivity_panel.rs
| /// Render this task back to markdown checkbox syntax. | ||
| #[cfg(test)] | ||
| pub fn to_markdown(&self) -> String { | ||
| let checkbox = if self.completed { "[x]" } else { "[ ]" }; | ||
| let priority = match self.priority { | ||
| 2 => "!! ", | ||
| 1 => "! ", | ||
| _ => "", | ||
| }; | ||
| format!("- {} {}{}", checkbox, priority, self.text) | ||
| } |
There was a problem hiding this comment.
Fix the format string to avoid double-space when priority is zero.
The current format string format!("- {} {}{}", checkbox, priority, self.text) inserts a literal space between the checkbox and priority. When priority is empty (""), this creates a double-space before the text:
- Produces:
"- [ ] Test"(two spaces before "Test") - Test expects (Line 1500):
"- [ ] Test"(one space)
🐛 Proposed fix
#[cfg(test)]
pub fn to_markdown(&self) -> String {
let checkbox = if self.completed { "[x]" } else { "[ ]" };
let priority = match self.priority {
- 2 => "!! ",
- 1 => "! ",
- _ => "",
+ 2 => " !! ",
+ 1 => " ! ",
+ _ => " ",
};
- format!("- {} {}{}", checkbox, priority, self.text)
+ format!("- {}{}{}", checkbox, priority, self.text)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /// Render this task back to markdown checkbox syntax. | |
| #[cfg(test)] | |
| pub fn to_markdown(&self) -> String { | |
| let checkbox = if self.completed { "[x]" } else { "[ ]" }; | |
| let priority = match self.priority { | |
| 2 => "!! ", | |
| 1 => "! ", | |
| _ => "", | |
| }; | |
| format!("- {} {}{}", checkbox, priority, self.text) | |
| } | |
| /// Render this task back to markdown checkbox syntax. | |
| #[cfg(test)] | |
| pub fn to_markdown(&self) -> String { | |
| let checkbox = if self.completed { "[x]" } else { "[ ]" }; | |
| let priority = match self.priority { | |
| 2 => " !! ", | |
| 1 => " ! ", | |
| _ => " ", | |
| }; | |
| format!("- {}{}{}", checkbox, priority, self.text) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/ui/productivity_panel.rs` around lines 88 - 98, The format string in the
to_markdown method has a literal space between the checkbox and priority
placeholder, which creates a double-space when priority is empty. Fix this by
modifying the format string and priority handling so that a space only appears
before the priority when the priority string is not empty. One approach is to
conditionally build the priority string with a leading space only when priority
is not an empty string, or restructure the format arguments to eliminate the
extra space.
|
Fresh CI follow-up from local triage:
Local follow-up on this branch still shows the touched-file validation passing:
I am keeping #152 narrow rather than mixing these unrelated runtime baseline failures into it. If full green CI is required for merge, the next step should be one or more follow-up baseline PRs for the runtime failures above. |
Summary
#[cfg(test)]and align the back-edge test importTask::to_markdown()helper for existing productivity panel testsValidation
git diff --checkcargo check --locked --quietcargo test --locked test_task_to_markdown -- --nocapturecargo test --locked test_new_history -- --nocapturecargo test --locked test_simple_undo -- --nocapturecargo test --locked classify_normalizes_case -- --nocapturecargo test --locked status_glyphs -- --nocapturecargo test --locked test_parse_direction -- --nocapturecargo test --locked fc_83a_inner_e_to_b_goes_up_first -- --nocaptureNotes
cargo fmt --all -- --checkcurrently fails on pre-existing repository-wide formatting debt outside this patch, including trailing whitespace insrc/editor/widget.rs.Summary by CodeRabbit