diff options
| author | William Boman <william@redwill.se> | 2022-05-06 17:55:17 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2022-05-06 17:55:49 +0200 |
| commit | 6f82a174709c2767281916d02e2cac1d7a6dba6e (patch) | |
| tree | 13e19ac9a01df6825e412305fd385d7f0c406156 /tests/ui_spec.lua | |
| parent | Added the Astro Language Server (#677) (diff) | |
| download | mason-6f82a174709c2767281916d02e2cac1d7a6dba6e.tar mason-6f82a174709c2767281916d02e2cac1d7a6dba6e.tar.gz mason-6f82a174709c2767281916d02e2cac1d7a6dba6e.tar.bz2 mason-6f82a174709c2767281916d02e2cac1d7a6dba6e.tar.lz mason-6f82a174709c2767281916d02e2cac1d7a6dba6e.tar.xz mason-6f82a174709c2767281916d02e2cac1d7a6dba6e.tar.zst mason-6f82a174709c2767281916d02e2cac1d7a6dba6e.zip | |
chore(tests): use assert.same instead of abusing vim.inspect + assert.equal
Diffstat (limited to 'tests/ui_spec.lua')
| -rw-r--r-- | tests/ui_spec.lua | 135 |
1 files changed, 63 insertions, 72 deletions
diff --git a/tests/ui_spec.lua b/tests/ui_spec.lua index 0c075eef..d945bfbf 100644 --- a/tests/ui_spec.lua +++ b/tests/ui_spec.lua @@ -23,47 +23,41 @@ describe("ui", function() }) end - assert.equal( - vim.inspect { - children = { - { - type = "HL_TEXT", - lines = { - { { "I'm not active", "" } }, - { { "Another line", "" } }, - }, - }, - { - type = "NODE", - children = {}, + assert.same({ + children = { + { + type = "HL_TEXT", + lines = { + { { "I'm not active", "" } }, + { { "Another line", "" } }, }, }, - styles = { "INDENT" }, - type = "CASCADING_STYLE", + { + type = "NODE", + children = {}, + }, }, - vim.inspect(renderer { is_active = false }) - ) + styles = { "INDENT" }, + type = "CASCADING_STYLE", + }, renderer { is_active = false }) - assert.equal( - vim.inspect { - children = { - { - type = "NODE", - children = {}, - }, - { - type = "HL_TEXT", - lines = { - { { "I'm active", "" } }, - { { "Yet another line", "" } }, - }, + assert.same({ + children = { + { + type = "NODE", + children = {}, + }, + { + type = "HL_TEXT", + lines = { + { { "I'm active", "" } }, + { { "Yet another line", "" } }, }, }, - styles = { "INDENT" }, - type = "CASCADING_STYLE", }, - vim.inspect(renderer { is_active = true }) - ) + styles = { "INDENT" }, + type = "CASCADING_STYLE", + }, renderer { is_active = true }) end) it("renders a tree correctly", function() @@ -91,47 +85,44 @@ describe("ui", function() }) ) - assert.equal( - vim.inspect { - highlights = { - { - col_start = 2, - col_end = 14, - line = 0, - hl_group = "MyHighlightGroup", - }, - { - col_start = 2, - col_end = 14, - line = 1, - hl_group = "Comment", - }, - { - col_start = 2, - col_end = 23, - line = 2, - hl_group = "Stuff", - }, + assert.same({ + highlights = { + { + col_start = 2, + col_end = 14, + line = 0, + hl_group = "MyHighlightGroup", }, - lines = { " Hello World!", " Another Line", " Install something idk", " I'm a text node" }, - virt_texts = {}, - keybinds = { - { - effect = "INSTALL_SERVER", - key = "i", - line = -1, - payload = { "sumneko_lua" }, - }, - { - effect = "INSTALL_SERVER", - key = "<CR>", - line = 3, - payload = { "tsserver" }, - }, + { + col_start = 2, + col_end = 14, + line = 1, + hl_group = "Comment", + }, + { + col_start = 2, + col_end = 23, + line = 2, + hl_group = "Stuff", }, }, - vim.inspect(render_output) - ) + lines = { " Hello World!", " Another Line", " Install something idk", " I'm a text node" }, + virt_texts = {}, + keybinds = { + { + effect = "INSTALL_SERVER", + key = "i", + line = -1, + payload = { "sumneko_lua" }, + }, + { + effect = "INSTALL_SERVER", + key = "<CR>", + line = 3, + payload = { "tsserver" }, + }, + }, + }, render_output) end) end) |
