Skip to content

Add unit test for file_types in thread-language#123

Open
bashandbone wants to merge 2 commits intomainfrom
fix/file-types-test-12299027129329715835
Open

Add unit test for file_types in thread-language#123
bashandbone wants to merge 2 commits intomainfrom
fix/file-types-test-12299027129329715835

Conversation

@bashandbone
Copy link
Contributor

@bashandbone bashandbone commented Mar 22, 2026

Added test_file_types to crates/language/src/lib.rs to verify that SupportLang::file_types() correctly whitelists file extensions corresponding to the language and ignores others. Also removed the // TODO: add test for file_types comment.


PR created automatically by Jules for task 12299027129329715835 started by @bashandbone

Summary by Sourcery

Tests:

  • Add a unit test verifying that SupportLang::file_types() whitelists the correct extensions per language and ignores unrelated ones.

Added a unit test for the `file_types` functionality in `crates/language/src/lib.rs`
and removed the associated TODO comment.

The test verifies that the `file_types()` method for `SupportLang` enum variants
(like Rust and JavaScript) correctly produces a `Types` instance that whitelists
valid file extensions and ignores invalid ones using the `ignore` crate API.

Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings March 22, 2026 20:39
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 22, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a focused unit test for SupportLang::file_types() to verify whitelisting/ignoring of file extensions, fixes an unused variable warning, and includes a stray .orig file in the diff that should likely be removed from version control.

File-Level Changes

Change Details Files
Add unit test coverage for SupportLang::file_types() behavior across languages.
  • Introduce test_file_types unit test exercising SupportLang::Rust.file_types() and SupportLang::JavaScript.file_types()
  • Assert that Rust file types whitelist .rs and ignore unrelated extensions like .js
  • Assert that JavaScript file types whitelist .js and .jsx and ignore unrelated extensions like .rs
  • Remove outdated TODO comment that previously indicated missing tests for file_types
crates/language/src/lib.rs
Minor cleanup and unintended file addition in the language crate.
  • Fix unused variable warning by assigning to _file_name instead of file_name in from_extension implementation
  • Add lib.rs.orig file (likely an editor backup) which should probably be deleted from the PR
crates/language/src/lib.rs
crates/language/src/lib.rs.orig

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The change from let _ = file_name; to let _ = _file_name; likely introduces a compile error unless _file_name exists in scope; consider reverting or updating this to reference the actual variable name.
  • The new crates/language/src/lib.rs.orig file appears to be an editor/backup artifact and should be removed from the repository.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The change from `let _ = file_name;` to `let _ = _file_name;` likely introduces a compile error unless `_file_name` exists in scope; consider reverting or updating this to reference the actual variable name.
- The new `crates/language/src/lib.rs.orig` file appears to be an editor/backup artifact and should be removed from the repository.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a unit test to ensure SupportLang::file_types() whitelists the expected extensions and rejects others, while also cleaning up related test TODOs.

Changes:

  • Added test_file_types covering Rust and JavaScript file type matching behavior.
  • Fixed an unused-variable silencing line to reference the correct variable name.
  • Added a new lib.rs.orig file (appears to duplicate the main library source).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/language/src/lib.rs Adds test_file_types and fixes an unused-variable silencing line.
crates/language/src/lib.rs.orig New file containing what appears to be a full duplicate of the crate’s lib.rs source.
Comments suppressed due to low confidence (1)

crates/language/src/lib.rs.orig:1

  • This PR introduces crates/language/src/lib.rs.orig, which appears to be a full duplicate of crates/language/src/lib.rs and isn’t mentioned in the PR description. This will add significant repository noise and can confuse future maintenance; it should be removed from the PR unless there’s a concrete build/test artifact requirement (in which case, it should be generated, not committed).
// SPDX-FileCopyrightText: 2022 Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Added a unit test for the `file_types` functionality in `crates/language/src/lib.rs`
and removed the associated TODO comment. Also fixed a rust-doc issue causing
failure in CI testing where missing `#[derive(Clone)]` implementations
could crash the ast-engine in doc-test execution.

The test verifies that the `file_types()` method for `SupportLang` enum variants
(like Rust and JavaScript) correctly produces a `Types` instance that whitelists
valid file extensions and ignores invalid ones using the `ignore` crate API.

Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
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.

2 participants