diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-07-23 17:42:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-23 11:42:37 -0400 |
| commit | 79644ab67731c7ba956c354bf0545282f34e10cc (patch) | |
| tree | e65dbf73b3442ab1aa9fc59fc56a35b4c9edf1e0 /lua/tests/automated/linked_list_spec.lua | |
| parent | 664690029fdb302bee8d3f27a458383e8477add7 (diff) | |
chore: use stylua for formatting (#1040)
* chore: stylua job and config
* reformat with stylua
Diffstat (limited to 'lua/tests/automated/linked_list_spec.lua')
| -rw-r--r-- | lua/tests/automated/linked_list_spec.lua | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/lua/tests/automated/linked_list_spec.lua b/lua/tests/automated/linked_list_spec.lua index 49c035a..bc17ba1 100644 --- a/lua/tests/automated/linked_list_spec.lua +++ b/lua/tests/automated/linked_list_spec.lua @@ -1,131 +1,131 @@ -local LinkedList = require('telescope.algos.linked_list') +local LinkedList = require "telescope.algos.linked_list" -describe('LinkedList', function() - it('can create a list', function() +describe("LinkedList", function() + it("can create a list", function() local l = LinkedList:new() assert.are.same(0, l.size) end) - it('can add a single entry to the list', function() + it("can add a single entry to the list", function() local l = LinkedList:new() - l:append('hello') + l:append "hello" assert.are.same(1, l.size) end) - it('can iterate over one item', function() + it("can iterate over one item", function() local l = LinkedList:new() - l:append('hello') + l:append "hello" for val in l:iter() do - assert.are.same('hello', val) + assert.are.same("hello", val) end end) - it('iterates in order', function() + it("iterates in order", function() local l = LinkedList:new() - l:append('hello') - l:append('world') + l:append "hello" + l:append "world" local x = {} for val in l:iter() do table.insert(x, val) end - assert.are.same({'hello', 'world'}, x) + assert.are.same({ "hello", "world" }, x) end) - it('iterates in order, for prepend', function() + it("iterates in order, for prepend", function() local l = LinkedList:new() - l:prepend('world') - l:prepend('hello') + l:prepend "world" + l:prepend "hello" local x = {} for val in l:iter() do table.insert(x, val) end - assert.are.same({'hello', 'world'}, x) + assert.are.same({ "hello", "world" }, x) end) - it('iterates in order, for combo', function() + it("iterates in order, for combo", function() local l = LinkedList:new() - l:prepend('world') - l:prepend('hello') - l:append('last') - l:prepend('first') + l:prepend "world" + l:prepend "hello" + l:append "last" + l:prepend "first" local x = {} for val in l:iter() do table.insert(x, val) end - assert.are.same({'first', 'hello', 'world', 'last'}, x) + assert.are.same({ "first", "hello", "world", "last" }, x) assert.are.same(#x, l.size) end) - it('has ipairs', function() + it("has ipairs", function() local l = LinkedList:new() - l:prepend('world') - l:prepend('hello') - l:append('last') - l:prepend('first') + l:prepend "world" + l:prepend "hello" + l:append "last" + l:prepend "first" local x = {} for v in l:iter() do table.insert(x, v) end - assert.are.same({'first', 'hello', 'world', 'last'}, x) + assert.are.same({ "first", "hello", "world", "last" }, x) local expected = {} for i, v in ipairs(x) do - table.insert(expected, {i, v}) + table.insert(expected, { i, v }) end local actual = {} for i, v in l:ipairs() do - table.insert(actual, {i, v}) + table.insert(actual, { i, v }) end assert.are.same(expected, actual) end) - describe('track_at', function() - it('should update tracked when only appending', function() + describe("track_at", function() + it("should update tracked when only appending", function() local l = LinkedList:new { track_at = 2 } - l:append("first") - l:append("second") - l:append("third") + l:append "first" + l:append "second" + l:append "third" assert.are.same("second", l.tracked) end) - it('should update tracked when first some prepend and then append', function() + it("should update tracked when first some prepend and then append", function() local l = LinkedList:new { track_at = 2 } - l:prepend("first") - l:append("second") - l:append("third") + l:prepend "first" + l:append "second" + l:append "third" assert.are.same("second", l.tracked) end) - it('should update when only prepending', function() + it("should update when only prepending", function() local l = LinkedList:new { track_at = 2 } - l:prepend("third") - l:prepend("second") - l:prepend("first") + l:prepend "third" + l:prepend "second" + l:prepend "first" assert.are.same("second", l.tracked) end) - it('should update when lots of prepend and append', function() + it("should update when lots of prepend and append", function() local l = LinkedList:new { track_at = 2 } - l:prepend("third") - l:prepend("second") - l:prepend("first") - l:append("fourth") - l:prepend("zeroth") + l:prepend "third" + l:prepend "second" + l:prepend "first" + l:append "fourth" + l:prepend "zeroth" assert.are.same("first", l.tracked) end) |
