summaryrefslogtreecommitdiff
path: root/snakemake-test.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-05-07 15:00:54 -0400
committerKyle Meyer <kyle@kyleam.com>2016-05-11 01:41:16 -0400
commit2ddaa5a5bf4d74b51f64720ea1be94bf06394c41 (patch)
tree42504679f83caa1cbc14ed3fe99c98502bc5de1a /snakemake-test.el
parent97b008e65f0402388cfacd32aee3b4dd4fbaf2ff (diff)
downloadsnakemake-mode-2ddaa5a5bf4d74b51f64720ea1be94bf06394c41.tar.gz
Define defun navigation commands
Diffstat (limited to 'snakemake-test.el')
-rw-r--r--snakemake-test.el106
1 files changed, 106 insertions, 0 deletions
diff --git a/snakemake-test.el b/snakemake-test.el
index d6f3d81..d725345 100644
--- a/snakemake-test.el
+++ b/snakemake-test.el
@@ -575,6 +575,112 @@ rule abc:
output: 'file'"
(snakemake-block-bounds))))
+(ert-deftest snakemake-test-beginning-of-block ()
+ (should
+ (string= "
+rule abc:
+ output: 'file'"
+ (snakemake-with-temp-text
+ "
+<point>rule abc:
+ output: 'file'"
+ (snakemake-beginning-of-block)
+ (buffer-substring (point) (point-max)))))
+ (should
+ (string= "rule abc:
+ output: 'file'"
+ (snakemake-with-temp-text
+ "
+rule abc:
+ output: <point>'file'"
+ (snakemake-beginning-of-block)
+ (buffer-substring (point) (point-max)))))
+ (should
+ (string= "rule abc:
+ output: 'file'
+
+"
+ (snakemake-with-temp-text
+ "
+rule abc:
+ output: 'file'
+
+<point>"
+ (snakemake-beginning-of-block)
+ (buffer-substring (point) (point-max)))))
+ (should
+ (string= "rule abc:
+ \"\"\"docstring header
+
+ docstring line
+ \"\"\"
+ output: 'file'"
+ (snakemake-with-temp-text
+ "
+rule abc:
+ \"\"\"docstring header
+
+ docstring line
+ \"\"\"
+ output: 'file'<point>"
+ (snakemake-beginning-of-block)
+ (buffer-substring (point) (point-max)))))
+ (should
+ (string= "subworkflow otherworkflow:
+ workdir: '../path/to/otherworkflow'
+ snakefile: '../path/to/otherworkflow/Snakefile'"
+ (snakemake-with-temp-text
+ "
+subworkflow otherworkflow:
+<point> workdir: '../path/to/otherworkflow'
+ snakefile: '../path/to/otherworkflow/Snakefile'"
+ (snakemake-beginning-of-block)
+ (buffer-substring (point) (point-max))))))
+
+(ert-deftest snakemake-test-end-of-block ()
+ (should
+ (string= "
+rule abc:
+ output: 'file'
+
+
+"
+ (snakemake-with-temp-text
+ "
+rule abc:
+<point> output: 'file'
+
+
+"
+ (snakemake-end-of-block)
+ (buffer-substring (point-min) (point)))))
+ (should
+ (string= "
+rule abc:
+ output: 'file'
+"
+ (snakemake-with-temp-text
+ "
+rule abc:<point>
+ output: 'file'
+
+rule xyz:
+ input: 'file'"
+ (snakemake-end-of-block)
+ (buffer-substring (point-min) (point)))))
+ (should
+ (string= "
+rule abc:
+ output: 'file'"
+ (snakemake-with-temp-text
+ "
+rule abc:<point>
+ output: 'file'
+rule xyz:
+ input: 'file'"
+ (snakemake-end-of-block)
+ (buffer-substring (point-min) (point))))))
+
;;; snakemake.el