Skip to content

Migrate formatting tests to file-based approach - #667

Merged
AbdullinAM merged 3 commits into
mainfrom
abdullin/tests
Aug 12, 2026
Merged

Migrate formatting tests to file-based approach#667
AbdullinAM merged 3 commits into
mainfrom
abdullin/tests

Conversation

@AbdullinAM

@AbdullinAM AbdullinAM commented Aug 11, 2026

Copy link
Copy Markdown
Member
  • Add support for per-case directives
  • Migrate formatting tests to file-based approach

Note: The total amount of tests has changed from 797 to 867. This difference comes from:

  1. New idempotency check tests. For each file-based test that has a separate .output file we also generate an additional Format is idempotent test. This accounts for 100 new tests
  2. Merged/removed tests. During the manual analysis and migration of test cases some of them were merged into a single file (when they test the same concept) or removed (if the test duplicates already existing one). This accounts for -30 total tests

Note 2: KDocFormatterTest is still left in its original form, it will require more handling and will be addressed in a separate commit later. This PR is just migration of tests that I have already processed in a separate fork

@qwwdfsad

Copy link
Copy Markdown
Member

Note: we'll check if .git-blame-ignore-revs works for this type of changes

@qwwdfsad qwwdfsad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I haven't manually looked through every test case obviously, only infra, I assume you've used some kind of deterministic automatic migration for that (worth noting in the squashed commit message for the history sake).

I see there are around ~70 new tests (863 vs 797), could you please elaborate on where they came from?

Comment thread core/src/main/kotlin/org/jetbrains/ktfmt/format/FormattingOptions.kt Outdated
Comment thread core/src/test/kotlin/org/jetbrains/ktfmt/testutil/CaseConfig.kt
* Replace `FormatterTest` and `GoogleStyleFormatterKtTest` with
file-based cases under cases/
* Move parse-error tests from `FormatterTest` to `ParserTest`

@qwwdfsad qwwdfsad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+7000, -11000 LGTM 👍

(that's me trying to be funny, all good)

@AbdullinAM
AbdullinAM merged commit 3dff888 into main Aug 12, 2026
5 checks passed
@AbdullinAM
AbdullinAM deleted the abdullin/tests branch August 12, 2026 10:38
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