Skip to content

Commit

Permalink
Fix test warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
notomo committed Sep 9, 2024
1 parent 9fe2dbb commit f26022a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 17 deletions.
3 changes: 2 additions & 1 deletion spec/lua/cmdbuf/handler/lua/cmd_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local helper = require("cmdbuf.test.helper")
local cmdbuf = helper.require("cmdbuf")
local assert = require("assertlib").typed(assert)

describe("lua/cmd handler", function()
before_each(helper.before_each)
Expand Down Expand Up @@ -104,7 +105,7 @@ describe("lua/cmd handler", function()

helper.execute_as_expr_keymap(cmdbuf.cmdline_expr() .. "1<CR>")

assert.equals(18888, vim.b.cmdbuf_test)
assert.equal(18888, vim.b.cmdbuf_test)
end)

it("can specific lua prefixed line", function()
Expand Down
5 changes: 3 additions & 2 deletions spec/lua/cmdbuf/handler/lua/variable/buffer_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local helper = require("cmdbuf.test.helper")
local cmdbuf = helper.require("cmdbuf")
local assert = require("assertlib").typed(assert)

describe("lua/variable/buffer handler", function()
before_each(helper.before_each)
Expand All @@ -20,7 +21,7 @@ describe("lua/variable/buffer handler", function()

cmdbuf.execute({ quit = true })

assert.is_same(8888, vim.b.execute_test)
assert.same(8888, vim.b.execute_test)
end)

it("adds history on execution", function()
Expand Down Expand Up @@ -81,7 +82,7 @@ describe("lua/variable/buffer handler", function()

helper.execute_as_expr_keymap(cmdbuf.cmdline_expr() .. "1<CR>")

assert.equals(18888, vim.b.cmdbuf_test)
assert.equal(18888, vim.b.cmdbuf_test)
end)

it("can specific lua prefixed line", function()
Expand Down
5 changes: 3 additions & 2 deletions spec/lua/cmdbuf/handler/lua/variable/global_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local helper = require("cmdbuf.test.helper")
local cmdbuf = helper.require("cmdbuf")
local assert = require("assertlib").typed(assert)

describe("lua/variable/global handler", function()
before_each(helper.before_each)
Expand All @@ -20,7 +21,7 @@ describe("lua/variable/global handler", function()

cmdbuf.execute({ quit = true })

assert.is_same(8888, vim.g.execute_test)
assert.same(8888, vim.g.execute_test)
end)

it("adds history on execution", function()
Expand Down Expand Up @@ -72,7 +73,7 @@ describe("lua/variable/global handler", function()

helper.execute_as_expr_keymap(cmdbuf.cmdline_expr() .. "1<CR>")

assert.equals(18888, vim.g.cmdbuf_global_test)
assert.equal(18888, vim.g.cmdbuf_global_test)
end)

it("can specific lua prefixed line", function()
Expand Down
3 changes: 2 additions & 1 deletion spec/lua/cmdbuf/handler/vim/cmd_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local helper = require("cmdbuf.test.helper")
local cmdbuf = helper.require("cmdbuf")
local assert = require("assertlib").typed(assert)

describe("vim/cmd handler", function()
before_each(helper.before_each)
Expand Down Expand Up @@ -76,6 +77,6 @@ describe("vim/cmd handler", function()

helper.execute_as_expr_keymap(cmdbuf.cmdline_expr() .. "1<CR>")

assert.equals(18888, vim.g.cmdbuf_test)
assert.equal(18888, vim.g.cmdbuf_test)
end)
end)
3 changes: 2 additions & 1 deletion spec/lua/cmdbuf/handler/vim/env_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local helper = require("cmdbuf.test.helper")
local cmdbuf = helper.require("cmdbuf")
local assert = require("assertlib").typed(assert)

describe("vim/env handler", function()
before_each(function()
Expand Down Expand Up @@ -49,6 +50,6 @@ describe("vim/env handler", function()

helper.execute_as_expr_keymap(cmdbuf.cmdline_expr() .. "<CR>")

assert.equals("cmdline", vim.env.CMDBUF_CMDLINE_TEST)
assert.equal("cmdline", vim.env.CMDBUF_CMDLINE_TEST)
end)
end)
3 changes: 2 additions & 1 deletion spec/lua/cmdbuf/handler/vim/input_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local helper = require("cmdbuf.test.helper")
local cmdbuf = helper.require("cmdbuf")
local assert = require("assertlib").typed(assert)

describe("vim/input handler", function()
before_each(helper.before_each)
Expand Down Expand Up @@ -46,6 +47,6 @@ describe("vim/input handler", function()

helper.execute_as_expr_keymap(cmdbuf.cmdline_expr() .. "let b:cmdbuf_input=1<CR>")

assert.equals(1, vim.b.cmdbuf_input)
assert.equal(1, vim.b.cmdbuf_input)
end)
end)
7 changes: 4 additions & 3 deletions spec/lua/cmdbuf/handler/vim/search/backward_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local helper = require("cmdbuf.test.helper")
local cmdbuf = helper.require("cmdbuf")
local assert = require("assertlib").typed(assert)

describe("vim/search/backward handler", function()
before_each(helper.before_each)
Expand All @@ -22,9 +23,9 @@ describe("vim/search/backward handler", function()
cmdbuf.execute({ quit = true })

assert.cursor_word("target")
assert.equals("target", vim.fn.getreg("/"))
assert.equals(1, vim.v.hlsearch)
assert.equals(0, vim.v.searchforward)
assert.equal("target", vim.fn.getreg("/"))
assert.equal(1, vim.v.hlsearch)
assert.equal(0, vim.v.searchforward)
end)

it("adds history on execution", function()
Expand Down
7 changes: 4 additions & 3 deletions spec/lua/cmdbuf/handler/vim/search/forward_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local helper = require("cmdbuf.test.helper")
local cmdbuf = helper.require("cmdbuf")
local assert = require("assertlib").typed(assert)

describe("vim/search/forward handler", function()
before_each(helper.before_each)
Expand All @@ -22,9 +23,9 @@ describe("vim/search/forward handler", function()
cmdbuf.execute({ quit = true })

assert.cursor_word("target")
assert.equals("target", vim.fn.getreg("/"))
assert.equals(1, vim.v.hlsearch)
assert.equals(1, vim.v.searchforward)
assert.equal("target", vim.fn.getreg("/"))
assert.equal(1, vim.v.hlsearch)
assert.equal(1, vim.v.searchforward)
end)

it("adds history on execution", function()
Expand Down
7 changes: 4 additions & 3 deletions spec/lua/cmdbuf/init_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local helper = require("cmdbuf.test.helper")
local cmdbuf = helper.require("cmdbuf")
local assert = require("assertlib").typed(assert)

describe("cmdbuf.nvim", function()
before_each(helper.before_each)
Expand Down Expand Up @@ -128,7 +129,7 @@ history2]])

cmdbuf.open()

assert.is_same("fired_cmdbuf_new!", vim.b.cmdbuf_test)
assert.same("fired_cmdbuf_new!", vim.b.cmdbuf_test)
end)

it("can restore the buffer even if it was closed by :quit!", function()
Expand Down Expand Up @@ -274,7 +275,7 @@ history2]])

local got = cmdbuf.get_context()

assert.is_same(got, {
assert.same(got, {
type = "vim/cmd",
})
end)
Expand All @@ -286,7 +287,7 @@ history2]])

local got = cmdbuf.get_context({ bufnr = bufnr })

assert.is_same(got, {
assert.same(got, {
type = "vim/cmd",
})
end)
Expand Down

0 comments on commit f26022a

Please sign in to comment.