From 2ddaa5a5bf4d74b51f64720ea1be94bf06394c41 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 7 May 2016 15:00:54 -0400 Subject: Define defun navigation commands --- snakemake-test.el | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) (limited to 'snakemake-test.el') 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 + " +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: 'file'" + (snakemake-beginning-of-block) + (buffer-substring (point) (point-max))))) + (should + (string= "rule abc: + output: 'file' + +" + (snakemake-with-temp-text + " +rule abc: + output: 'file' + +" + (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'" + (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: + 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: + output: 'file' + + +" + (snakemake-end-of-block) + (buffer-substring (point-min) (point))))) + (should + (string= " +rule abc: + output: 'file' +" + (snakemake-with-temp-text + " +rule abc: + 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: + output: 'file' +rule xyz: + input: 'file'" + (snakemake-end-of-block) + (buffer-substring (point-min) (point)))))) + ;;; snakemake.el -- cgit v1.2.3