Skip to content

refactor: tests: add remaining tests (multi-command ones) besides ones with select#1619

Open
kkysen wants to merge 4 commits intomasterfrom
kkysen/refactor-tests-multiple-commands
Open

refactor: tests: add remaining tests (multi-command ones) besides ones with select#1619
kkysen wants to merge 4 commits intomasterfrom
kkysen/refactor-tests-multiple-commands

Conversation

@kkysen
Copy link
Contributor

@kkysen kkysen commented Feb 25, 2026

This adds all multi-command refactor tests besides tests with select.

This runs multiple refactor commands with just multiple refactor(...).test()s. This generates a separate snapshot for each command, but this should be fine, and gives us more data to inspect if anything goes wrong.

The old tests used ; for this, which avoids running the refactorer again. Now we run the refactorer from scratch for each command. This avoids the need to commit in between certain commands in order to re-evaluate the AST, as commit is broken (see #1605).

@kkysen kkysen requested a review from ahomescu February 25, 2026 01:46
@kkysen kkysen changed the title refactor: tests: port autoretype_array to a snapshot test refactor: tests: add remaining tests (multi-command ones) Feb 25, 2026
Copy link
Contributor Author

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

Does this look like it should work? I'll add the rest of them if so.

@kkysen kkysen force-pushed the kkysen/refactor-tests-multiple-commands branch from 0591e9d to a266f30 Compare February 25, 2026 02:05
Base automatically changed from kkysen/refactor-tests-should_panic to master February 26, 2026 06:05
`git` didn't recognize this as a pure move, but it is.

This runs multiple refactor commands with just multiple `refactor(...).test()`s.
This generates a separate snapshot for each command, but this should be fine,
and gives us more data to inspect if anything goes wrong.

The old test used `;` for this, which avoids running the refactorer again.
Now we run the refactorer from scratch for each command.
This avoids the need to `commit` in between certain commands
in order to re-evaluate the AST, as `commit` is broken (see #1605).
`git` didn't recognize this as a pure move, but it is.
@kkysen kkysen force-pushed the kkysen/refactor-tests-multiple-commands branch from a266f30 to 1796af0 Compare February 27, 2026 07:30
It appears this test is now broken,
as the generated `fn add` is marked `unsafe`
when it doesn't appear it should be.
`git` didn't recognize this as a pure move, but it is.

This test was supposed to test if changes are visible across `commit`s,
even when those changes aren't written to the original file
(like with the `--rewrite-mode alongside` used by [`refactor`],
and unlike with `--rewrite-mode inplace`).
However, `commit` is currently broken (see #1605),
so this test is not actually testing what it's meant to.
The places where `commit`s are supposed to go
are left as comments for now until we fix `commit`.
"x - y",
])
.named("abstract.new")
.expect_compile_error(true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ahomescu, see, it turned out to be useful to keep for a second command.

@kkysen kkysen changed the title refactor: tests: add remaining tests (multi-command ones) refactor: tests: add remaining tests (multi-command ones) besides ones with select Feb 27, 2026
@kkysen kkysen requested a review from ahomescu February 27, 2026 07:54
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.

Refactorer tests are not run in CI

2 participants