aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--snakemake-mode.el1
-rw-r--r--snakemake-test.el51
2 files changed, 52 insertions, 0 deletions
diff --git a/snakemake-mode.el b/snakemake-mode.el
index dc9fbf8..319a0d8 100644
--- a/snakemake-mode.el
+++ b/snakemake-mode.el
@@ -338,6 +338,7 @@ label."
(set (make-local-variable 'imenu-create-index-function)
#'snakemake-imenu-create-index)
(set (make-local-variable 'indent-line-function) 'snakemake-indent-line)
+ (set (make-local-variable 'indent-region-function) nil)
(set (make-local-variable 'font-lock-defaults)
`(,(append snakemake-font-lock-keywords python-font-lock-keywords))))
diff --git a/snakemake-test.el b/snakemake-test.el
index 6374b0d..eeb2e5f 100644
--- a/snakemake-test.el
+++ b/snakemake-test.el
@@ -469,6 +469,57 @@ rule abc:
(snakemake-indent-line)
(buffer-string)))))
+(ert-deftest snakemake-test/indent-region ()
+ (should
+ (string=
+ "
+rule abc:
+ input: 'infile'
+ output:"
+ (snakemake-with-temp-text
+ "
+<point>rule abc:
+input: 'infile'
+output:"
+ (indent-region (point) (point-max))
+ (buffer-string))))
+ (should
+ (string=
+ "
+rule abc:
+ input:
+ one='one', two='two'
+ output: 'out'
+ run:
+ with open(input.one) as ifh:
+ with open(output.out, 'w') as ofh:
+ ofh.write(ifh.read())"
+ (snakemake-with-temp-text
+ "
+<point>rule abc:
+input:
+one='one', two='two'
+output: 'out'
+run:
+with open(input.one) as ifh:
+with open(output.out, 'w') as ofh:
+ofh.write(ifh.read())"
+ (indent-region (point) (point-max))
+ (buffer-string))))
+ (should
+ (string=
+ "
+x = [1,
+ 2,
+ 3,]"
+ (snakemake-with-temp-text
+ "
+<point>x = [1,
+2,
+3,]"
+ (indent-region (point) (point-max))
+ (buffer-string)))))
+
;;;; Other
(ert-deftest snakemake-test-in-rule-or-subworkflow-block-p ()