Skip to content

Conversation

@Rudxain
Copy link
Contributor

@Rudxain Rudxain commented Dec 12, 2025

follow up of #818

@gemini-code-assist
Copy link

Summary of Changes

Hello @Rudxain, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request lays the groundwork for comprehensive testing of the pre_process_path function, particularly its handling of tilde expansion. By establishing a dedicated test module and a placeholder test, it prepares the codebase for robust validation of path processing logic, ensuring future modifications maintain expected behavior and correctness.

Highlights

  • Test Infrastructure: A new test module test has been introduced within crates/emmylua_code_analysis/src/config/mod.rs to house unit tests for configuration-related functionalities.
  • Tilde Expansion Test Placeholder: A placeholder test function pre_proc_path has been added, specifically intended for the pre_process_path function. This test will eventually cover tilde expansion logic, though it currently contains a panic!() and awaits full implementation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a placeholder test that unconditionally panics. I've provided a suggestion to replace it with a complete test for tilde expansion, as implied by the PR title. My suggestion includes a more descriptive test name and necessary imports. Additionally, I've noted a potential bug in the pre_process_path function when handling a path consisting of only ~, which a new test could help expose and address.

Comment on lines +207 to +215
#[cfg(test)]
mod test {
use super::pre_process_path;

#[test]
fn pre_proc_path() {
panic!()
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This test module is incomplete as the test just panics, which will cause the test suite to fail. The PR title suggests this is for testing tilde expansion, so I've implemented a basic test for that. I've also renamed the test function to be more descriptive and added the necessary imports.

Additionally, I noticed a potential bug in pre_process_path when handling a path that is just ~. The current implementation uses &path[2..], which will panic if the path is just ~ (length 1). You might want to add another test case for this and fix the implementation. A robust implementation would handle ~, ~/, and ~/path correctly.

Suggested change
#[cfg(test)]
mod test {
use super::pre_process_path;
#[test]
fn pre_proc_path() {
panic!()
}
}
#[cfg(test)]
mod test {
use super::pre_process_path;
use std::path::Path;
#[test]
fn test_tilde_expansion() {
if let Some(home_dir) = dirs::home_dir() {
let workspace = Path::new("/tmp");
let input = "~/foo";
let expected = home_dir.join("foo").to_string_lossy().to_string();
assert_eq!(pre_process_path(input, workspace), expected);
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant