From bdbb9c95d401b62d01fa80c04265bcd27658488a Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 5 Mar 2015 23:01:52 -0500 Subject: Indent field values that start on their own line Previously, indentation was handled only for the first line following a run value. Extend this to support any field value that starts on the line below a field key, since that is valid syntax. --- test-snakemake-mode.el | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'test-snakemake-mode.el') diff --git a/test-snakemake-mode.el b/test-snakemake-mode.el index a3afa7b..51a8a7e 100644 --- a/test-snakemake-mode.el +++ b/test-snakemake-mode.el @@ -120,6 +120,37 @@ rule abc: (snakemake-indent-line) (buffer-string)))) + ;; Below a naked rule field key + (should + (string= + " +rule abc: + output: + " + (snakemake-with-temp-text + " +rule abc: + output: +" + (snakemake-indent-line) + (buffer-string)))) + + ;; Below a naked rule field key, repeated + (should + (string= + " +rule abc: + output: + " + (snakemake-with-temp-text + " +rule abc: + output: +" + (snakemake-indent-line) + (snakemake-indent-line) + (buffer-string)))) + ;; Below a filled rule field key (should (string= @@ -247,6 +278,26 @@ subworkflow otherworkflow: snakefile: '../path/to/otherworkflow/Snakefile'" (should (snakemake-in-rule-or-subworkflow-block-p)))) +(ert-deftest test-snakemake-mode/below-naked-field-p () + "Test `snakemake-below-naked-field-p'." + (snakemake-with-temp-text + " +rule abc: + output: +" + (should (snakemake-below-naked-field-p))) + (snakemake-with-temp-text + " +rule abc: + output: 'file' +" + (should-not (snakemake-below-naked-field-p))) + (snakemake-with-temp-text + " +rule abc: + output: " + (should-not (snakemake-below-naked-field-p)))) + (ert-deftest test-snakemake-mode/run-field-line-p () "Test `snakemake-run-field-line-p'." (snakemake-with-temp-text -- cgit v1.2.3