Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ert indent testing #63

Merged
merged 4 commits into from Jan 3, 2019
Merged

Ert indent testing #63

merged 4 commits into from Jan 3, 2019

Conversation

etu
Copy link
Collaborator

@etu etu commented Jan 3, 2019

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:

nix-shell --pure --run "make test" -p gnumake emacs

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

Add a function `nix-indent-first-line-in-block` that checks if the
last word on the previous line is one of "let, import, [, =, (, {".
Then it adds two spaces of indent to the one of the previous line.

And if you stand on the first line of a file, it defaults to indenting
the line to zero spaces.
@matthewbauer
Copy link
Member

Thanks a lot! I want to get travis working but don't have permissions to add it on this repo.

@matthewbauer matthewbauer merged commit 6445ebf into NixOS:master Jan 3, 2019
@etu etu deleted the ert-indent-testing branch January 3, 2019 22:20
@etu
Copy link
Collaborator Author

etu commented Jan 3, 2019

@matthewbauer That would be great to have, do you know who to talk to to set that up?

@grahamc
Copy link
Member

grahamc commented Jan 3, 2019 via email

@grahamc
Copy link
Member

grahamc commented Jan 4, 2019

Travis is set up now.

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.

None yet

3 participants