Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So I've done some work on writing ert tests for indentation in nix-mode using nix-indent-line as indentation function.
Ignore the first commit 98426b9 since it's part of the PR #61 which kinda makes the indentation a lot better (imo).
But this PR depends on that change for this test to pass so I based this branch on those changes.
Tests run as easily as:
And to see that the test works for the test case I've added, just open the file
list-contents.nix
and mess something up in there (like de-indent something that should be indented) and run the test again. Then the indentation mode will fix the mess and compare it to the file -- which will fail.And, more tests are needed. Much more tests. For different cases. I will grab a few of the ones from #60 because they are quite small and good.
This work is heavily inspired by how php-mode does it's indentation testing, but quite much simpler since php has different indentation standards which we kinda can ignore here.
cc @grahamc @matthewbauer