branch: elpa/nix-mode
commit 02b59d9bcf24b77dea0d901c35a6958b4604f8df
Author: Elis Hirwing <[email protected]>
Commit: Elis Hirwing <[email protected]>
ert/indent: Add testcases for issues reported in #60
Related issue: https://github.com/NixOS/nix-mode/issues/60
---
tests/nix-mode-tests.el | 17 +++++++++++++++++
tests/testcases/issue-60.1.nix | 7 +++++++
tests/testcases/issue-60.2.nix | 8 ++++++++
tests/testcases/issue-60.3.nix | 8 ++++++++
4 files changed, 40 insertions(+)
diff --git a/tests/nix-mode-tests.el b/tests/nix-mode-tests.el
index 99ead019d5..7505908834 100644
--- a/tests/nix-mode-tests.el
+++ b/tests/nix-mode-tests.el
@@ -74,6 +74,23 @@ function to do the indentation tests."
"Proper indentation for items inside of a list."
(with-nix-mode-test ("list-contents.nix" :indent t)))
+(ert-deftest nix-mode-test-indent-issue-60-1 ()
+ "Proper indentation of attrsets inside of lists inside of attrsets.
+
+Related issue: https://github.com/NixOS/nix-mode/issues/60"
+ (with-nix-mode-test ("issue-60.1.nix" :indent t)))
+
+(ert-deftest nix-mode-test-indent-issue-60-2 ()
+ "Proper indentation of code inside of let blocks.
+
+Related issue: https://github.com/NixOS/nix-mode/issues/60"
+ (with-nix-mode-test ("issue-60.2.nix" :indent t)))
+
+(ert-deftest nix-mode-test-indent-issue-60-3 ()
+ "Proper indentation of import and newline after equal.
+
+Related issue: https://github.com/NixOS/nix-mode/issues/60"
+ (with-nix-mode-test ("issue-60.3.nix" :indent t)))
(provide 'nix-mode-tests)
;;; nix-mode-tests.el ends here
diff --git a/tests/testcases/issue-60.1.nix b/tests/testcases/issue-60.1.nix
new file mode 100644
index 0000000000..c575243447
--- /dev/null
+++ b/tests/testcases/issue-60.1.nix
@@ -0,0 +1,7 @@
+{
+ x86 = [
+ {
+ name = "t1.small.x86";
+ }
+ ];
+}
diff --git a/tests/testcases/issue-60.2.nix b/tests/testcases/issue-60.2.nix
new file mode 100644
index 0000000000..7a27cf793d
--- /dev/null
+++ b/tests/testcases/issue-60.2.nix
@@ -0,0 +1,8 @@
+let
+ x = [
+ (let y = 1; in y)
+ { foo = 1; }
+ [ 1 2 3 ]
+ x
+ ];
+in x
diff --git a/tests/testcases/issue-60.3.nix b/tests/testcases/issue-60.3.nix
new file mode 100644
index 0000000000..1cf7350a78
--- /dev/null
+++ b/tests/testcases/issue-60.3.nix
@@ -0,0 +1,8 @@
+let
+ mozilla-overlay =
+ import
+ (
+ builtins.fetchTarball
+ https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz
+ );
+in mozilla-overlay