summaryrefslogtreecommitdiff
path: root/snakemake-test.el
diff options
context:
space:
mode:
Diffstat (limited to 'snakemake-test.el')
-rw-r--r--snakemake-test.el51
1 files changed, 51 insertions, 0 deletions
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 ()