From 589d18ab68298fead08d49072cc94e501d9b64a8 Mon Sep 17 00:00:00 2001 From: Phelipe Teles Date: Mon, 6 Jun 2022 18:23:45 -0300 Subject: [PATCH] test(indents/yaml): add tests --- .../indent/yaml/autoindent-mapping-pair.yaml | 2 ++ tests/indent/yaml/indent-sequence-items.yaml | 2 ++ tests/indent/yaml_spec.lua | 20 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/indent/yaml/autoindent-mapping-pair.yaml create mode 100644 tests/indent/yaml/indent-sequence-items.yaml create mode 100644 tests/indent/yaml_spec.lua diff --git a/tests/indent/yaml/autoindent-mapping-pair.yaml b/tests/indent/yaml/autoindent-mapping-pair.yaml new file mode 100644 index 000000000..8dadeee47 --- /dev/null +++ b/tests/indent/yaml/autoindent-mapping-pair.yaml @@ -0,0 +1,2 @@ +- key1: value1 + key2: value2 diff --git a/tests/indent/yaml/indent-sequence-items.yaml b/tests/indent/yaml/indent-sequence-items.yaml new file mode 100644 index 000000000..8dadeee47 --- /dev/null +++ b/tests/indent/yaml/indent-sequence-items.yaml @@ -0,0 +1,2 @@ +- key1: value1 + key2: value2 diff --git a/tests/indent/yaml_spec.lua b/tests/indent/yaml_spec.lua new file mode 100644 index 000000000..91c60c227 --- /dev/null +++ b/tests/indent/yaml_spec.lua @@ -0,0 +1,20 @@ +local Runner = require("tests.indent.common").Runner +--local XFAIL = require("tests.indent.common").XFAIL + +local run = Runner:new(it, "tests/indent/yaml", { + shiftwidth = 2, + expandtab = true, +}) + +describe("indent YAML:", function() + describe("whole file:", function() + run:whole_file(".", { + expected_failures = {}, + }) + end) + + describe("new line:", function() + run:new_line("indent-sequence-items.yaml", { on_line = 2, text = "key3: value3", indent = 2 }) + run:new_line("autoindent-mapping-pair.yaml", { on_line = 1, text = "key3: value3", indent = 2 }) + end) +end)