diff options
| author | osthomas <8322329+osthomas@users.noreply.github.com> | 2025-09-07 13:58:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-07 13:58:28 +0200 |
| commit | fee71c102c54146f90b14c89711ddbb8f95a1484 (patch) | |
| tree | 50c590a933a11020180514460c7d0b1e53af2693 /tests | |
| parent | feat(parsers): update arduino, desktop, hurl, mlir, query, slint, snakemake, ... (diff) | |
| download | nvim-treesitter-fee71c102c54146f90b14c89711ddbb8f95a1484.tar nvim-treesitter-fee71c102c54146f90b14c89711ddbb8f95a1484.tar.gz nvim-treesitter-fee71c102c54146f90b14c89711ddbb8f95a1484.tar.bz2 nvim-treesitter-fee71c102c54146f90b14c89711ddbb8f95a1484.tar.lz nvim-treesitter-fee71c102c54146f90b14c89711ddbb8f95a1484.tar.xz nvim-treesitter-fee71c102c54146f90b14c89711ddbb8f95a1484.tar.zst nvim-treesitter-fee71c102c54146f90b14c89711ddbb8f95a1484.zip | |
feat(snakemake): update queries (#8106)
also add indent tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/indent/snakemake/blocks.smk | 22 | ||||
| -rw-r--r-- | tests/indent/snakemake/directive_parameters.smk | 36 | ||||
| -rw-r--r-- | tests/indent/snakemake_spec.lua | 49 |
3 files changed, 107 insertions, 0 deletions
diff --git a/tests/indent/snakemake/blocks.smk b/tests/indent/snakemake/blocks.smk new file mode 100644 index 000000000..fc10e7ae3 --- /dev/null +++ b/tests/indent/snakemake/blocks.smk @@ -0,0 +1,22 @@ +rule A: + """doc""" + +if True: + rule B: + """doc""" + +use rule other from somewhere + +use rule other2 from somewhere as other_alias + +use rule other3 from somewhere with: + input: 2 + +use rule other4 from somewhere as other_alias2 with: + input: 2 + +checkpoint C: + input: "1" + +module A: + snakefile: "x.smk" diff --git a/tests/indent/snakemake/directive_parameters.smk b/tests/indent/snakemake/directive_parameters.smk new file mode 100644 index 000000000..fa311bfb7 --- /dev/null +++ b/tests/indent/snakemake/directive_parameters.smk @@ -0,0 +1,36 @@ +rule A: + input: a + output: b + params: + a = 1, + b = 2, + c = 3 + shell: + """ + touch {output} + """ + +rule B: + input: a, + output: a, + b + params: + +rule C: + # test dedent after variably nested nodes + params: + 1 + params: + "1" + params: + a = 1 + params: + a = "1" + params: + a = call(1) + params: + a = call("1") + params: + a = config["a"] + params: + b = call(config["a"]) diff --git a/tests/indent/snakemake_spec.lua b/tests/indent/snakemake_spec.lua new file mode 100644 index 000000000..111d01113 --- /dev/null +++ b/tests/indent/snakemake_spec.lua @@ -0,0 +1,49 @@ +local Runner = require('tests.indent.common').Runner +local XFAIL = require('tests.indent.common').XFAIL + +local run = Runner:new(it, 'tests/indent/snakemake', { + tabstop = 4, + shiftwidth = 4, + softtabstop = 0, + expandtab = true, +}) + +describe('indent Snakemake:', function() + describe('whole file:', function() + run:whole_file('.', { + expected_failures = {}, + }) + end) + + describe('new line:', function() + run:new_line('blocks.smk', { on_line = 1, text = 'input: 1', indent = 4 }) + run:new_line('blocks.smk', { on_line = 2, text = 'input: 1', indent = 4 }) + run:new_line('blocks.smk', { on_line = 5, text = 'input: 1', indent = 8 }) + run:new_line('blocks.smk', { on_line = 6, text = 'input: 1', indent = 8 }) + run:new_line('blocks.smk', { on_line = 8, text = 'pass', indent = 0 }) + run:new_line('blocks.smk', { on_line = 10, text = 'pass', indent = 0 }) + run:new_line('blocks.smk', { on_line = 12, text = 'pass', indent = 4 }) + run:new_line('blocks.smk', { on_line = 15, text = 'pass', indent = 4 }) + run:new_line('directive_parameters.smk', { on_line = 4, text = 'before_a = 0,', indent = 8 }) + run:new_line('directive_parameters.smk', { on_line = 5, text = 'after_a = 1.1,', indent = 8 }) + run:new_line( + 'directive_parameters.smk', + { on_line = 7, text = '"""dedent_after_last_param"""', indent = 4 } + ) + run:new_line( + 'directive_parameters.smk', + { on_line = 14, text = 'b = "indent_after_param_with_comma"', indent = 8 } + ) + run:new_line( + 'directive_parameters.smk', + { on_line = 15, text = 'b = "indent_after_param_with_comma"', indent = 8 } + ) + run:new_line( + 'directive_parameters.smk', + { on_line = 17, text = 'b = "indent_after_opening"', indent = 8 } + ) + for _, line in ipairs({ 22, 24, 26, 28, 30, 32, 34, 36 }) do + run:new_line('directive_parameters.smk', { on_line = line, text = '"doc"', indent = 4 }) + end + end) +end) |
