Skip to content

🧪 Add tests for complex source constructs in canonicalize_in_source - #264

Open
undivisible wants to merge 1 commit into
masterfrom
test-in-canonical-7223696179011002812
Open

🧪 Add tests for complex source constructs in canonicalize_in_source#264
undivisible wants to merge 1 commit into
masterfrom
test-in-canonical-7223696179011002812

Conversation

@undivisible

@undivisible undivisible commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🎯 What: Added tests covering more syntax forms (field/index assignment, loops, match, if) in canonicalize_in_source for .in files.
📊 Coverage: Now tests constructs like while true, match, field assignment, and conditional if-else statements.
Result: Increased confidence in the correctness of the formatter.


PR created automatically by Jules for task 7223696179011002812 started by @undivisible


Note

Low Risk
Test-only change with no production or formatter logic modifications.

Overview
Adds canonicalizes_complex_source_constructs in in_canonical.rs to exercise canonicalize_in_source on a richer .in sample than existing tests.

The fixture includes a struct, field and index assignment, conditional while, match, if/else, an infinite while true with break, and returns. Assertions check that the canonical string still contains the expected formatted fragments (structs, lets, assignments, and control-flow headers).

Reviewed by Cursor Bugbot for commit f84aa0e. Configure here.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
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.

@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_643ced55-b356-419b-9db8-66bb87f88f98)

@mergify

mergify Bot commented Aug 12, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f84aa0ec7e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

assert!(canonical.contains("while p.x < 10 {"));
assert!(canonical.contains("match p.y {"));
assert!(canonical.contains("if p.x == 10 {"));
assert!(canonical.contains("while true {"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Assert that break survives canonicalization

When this input is canonicalized, Stmt::Break is currently rendered as an empty string in format_stmt, so the while true { break; } block becomes an infinite empty loop. This assertion checks only the loop header, allowing the new test to pass despite that semantic corruption; assert the rendered break (and ideally reparse the complete output) so the construct included by this test is actually covered.

Useful? React with 👍 / 👎.

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