-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Calculate the initial indent correctly in a couple edge cases. (#45
) 1. When the first seen line is one of the `group_prefixes`. 2. When the first seen line is another keep-sorted directive. Idempotency output before this change: ``` $ go test ./... ? github.com/google/keep-sorted [no test files] ? github.com/google/keep-sorted/cmd [no test files] --- FAIL: TestGoldens (0.66s) --- FAIL: TestGoldens/group (0.00s) --- FAIL: TestGoldens/group/group (0.66s) golden_test.go:105: keep-sorted diff on keep-sorted output (should be idempotent) (-want +got) ( """ ... // 180 identical lines case 5: // keep-sorted-test end - return 10 case 2: - return 2; case 4: + case 6: + return 10 + return 2; return 4; - case 6: return 6; // keep-sorted-test end """ ) FAIL FAIL github.com/google/keep-sorted/goldens 0.686s ok github.com/google/keep-sorted/keepsorted (cached) FAIL ``` Also, check the git history of this PR to see how group.out evolved.
- Loading branch information
Showing
5 changed files
with
404 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.