diff --git a/spec/gopher_spec.lua b/spec/gopher_spec.lua deleted file mode 100644 index b50b5ea..0000000 --- a/spec/gopher_spec.lua +++ /dev/null @@ -1,5 +0,0 @@ -describe("gopher", function() - it("can be required", function() - require "gopher" - end) -end) diff --git a/spec/gopher_struct_tags_spec.lua b/spec/gopher_struct_tags_spec.lua deleted file mode 100644 index ad8dd6e..0000000 --- a/spec/gopher_struct_tags_spec.lua +++ /dev/null @@ -1,49 +0,0 @@ -local cur_dir = vim.fn.expand "%:p:h" - -describe("gopher.struct_tags", function() - it("can be required", function() - require "gopher.struct_tags" - end) - - it("can add json tag to struct", function() - local tag = require "gopher.struct_tags" - local temp_file = vim.fn.tempname() .. ".go" - local input_file = vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/add_input.go") - local output_file = - vim.fn.join(vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/add_output.go"), "\n") - - vim.fn.writefile(input_file, temp_file) - vim.cmd("silent exe 'e " .. temp_file .. "'") - vim.bo.filetype = "go" - - local bufn = vim.fn.bufnr(0) - vim.fn.setpos(".", { bufn, 3, 6, 0 }) - tag.add() - - vim.wait(100) - assert.are.same(output_file, vim.fn.join(vim.fn.readfile(temp_file), "\n")) - - vim.cmd("bd! " .. temp_file) - end) - - it("can remove json tag from struct", function() - local tag = require "gopher.struct_tags" - local temp_file = vim.fn.tempname() .. ".go" - local input_file = vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/remove_input.go") - local output_file = - vim.fn.join(vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/remove_output.go"), "\n") - - vim.fn.writefile(input_file, temp_file) - vim.cmd("silent exe 'e " .. temp_file .. "'") - vim.bo.filetype = "go" - - local bufn = vim.fn.bufnr() - vim.fn.setpos(".", { bufn, 3, 6, 0 }) - tag.remove() - - vim.wait(100) - assert.are.same(output_file, vim.fn.join(vim.fn.readfile(temp_file), "\n")) - - vim.cmd("bd! " .. temp_file) - end) -end) diff --git a/spec/gopher_config_spec.lua b/spec/units/config_spec.lua similarity index 94% rename from spec/gopher_config_spec.lua rename to spec/units/config_spec.lua index 1d033c0..3693eb0 100644 --- a/spec/gopher_config_spec.lua +++ b/spec/units/config_spec.lua @@ -1,8 +1,4 @@ describe("gopher.config", function() - it("can be required", function() - require "gopher.config" - end) - it(".setup() when gets empty table not edit config", function() local c = require "gopher.config" c.setup {} diff --git a/spec/gopher_utils_spec.lua b/spec/units/utils_spec.lua similarity index 100% rename from spec/gopher_utils_spec.lua rename to spec/units/utils_spec.lua