From 65576b49de3803b4183d0094ee19347bcf4c9b49 Mon Sep 17 00:00:00 2001 From: supertree-wook Date: Wed, 5 Jun 2024 11:35:05 +0900 Subject: [PATCH 1/4] Update aftman tools --- aftman.toml | 6 ++--- testez.toml | 67 ----------------------------------------------------- testez.yml | 53 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 70 deletions(-) delete mode 100644 testez.toml create mode 100644 testez.yml diff --git a/aftman.toml b/aftman.toml index 3cafc84..7e30d75 100644 --- a/aftman.toml +++ b/aftman.toml @@ -1,6 +1,6 @@ [tools] -rojo = "rojo-rbx/rojo@7.3.0" +rojo = "rojo-rbx/rojo@7.4.1" run-in-roblox = "rojo-rbx/run-in-roblox@0.3.0" wally = "upliftgames/wally@0.3.2" -stylua = "johnnymorganz/stylua@0.18.1" -selene = "kampfkarren/selene@0.25.0" +selene = "Kampfkarren/selene@0.27.1" +stylua = "JohnnyMorganz/stylua@0.20.0" diff --git a/testez.toml b/testez.toml deleted file mode 100644 index adc2434..0000000 --- a/testez.toml +++ /dev/null @@ -1,67 +0,0 @@ -# TestEZ -[[afterAll.args]] -type = "function" - -[[afterEach.args]] -type = "function" - -[[beforeAll.args]] -type = "function" - -[[beforeEach.args]] -type = "function" - -[[describe.args]] -type = "string" - -[[describe.args]] -type = "function" - -[[describeFOCUS.args]] -type = "string" - -[[describeFOCUS.args]] -type = "function" - -[[describeSKIP.args]] -type = "string" - -[[describeSKIP.args]] -type = "function" - -[[expect.args]] -type = "any" - -[[FIXME.args]] -type = "string" -required = false - -[FOCUS] -args = [] - -[[it.args]] -type = "string" - -[[it.args]] -type = "function" - -[[itFIXME.args]] -type = "string" - -[[itFIXME.args]] -type = "function" - -[[itFOCUS.args]] -type = "string" - -[[itFOCUS.args]] -type = "function" - -[[itSKIP.args]] -type = "string" - -[[itSKIP.args]] -type = "function" - -[SKIP] -args = [] diff --git a/testez.yml b/testez.yml new file mode 100644 index 0000000..5c1adda --- /dev/null +++ b/testez.yml @@ -0,0 +1,53 @@ +--- +globals: + FIXME: + args: + - required: false + type: string + FOCUS: + args: [] + SKIP: + args: [] + afterAll: + args: + - type: function + afterEach: + args: + - type: function + beforeAll: + args: + - type: function + beforeEach: + args: + - type: function + describe: + args: + - type: string + - type: function + describeFOCUS: + args: + - type: string + - type: function + describeSKIP: + args: + - type: string + - type: function + expect: + args: + - type: any + it: + args: + - type: string + - type: function + itFIXME: + args: + - type: string + - type: function + itFOCUS: + args: + - type: string + - type: function + itSKIP: + args: + - type: string + - type: function \ No newline at end of file From 30a777a9f7305e1b88a9be7cba11071d23d1ce79 Mon Sep 17 00:00:00 2001 From: supertree-wook Date: Wed, 5 Jun 2024 11:39:50 +0900 Subject: [PATCH 2/4] Apply stylua --- .stylua.toml | 7 ------- src/Array/difference.lua | 4 ++-- src/Array/differenceSymmetric.lua | 4 ++-- src/Array/update.lua | 2 +- src/Array/zipAll.lua | 2 +- src/Dictionary/freeze.lua | 2 +- stylua.toml | 4 ++++ 7 files changed, 11 insertions(+), 14 deletions(-) delete mode 100644 .stylua.toml create mode 100644 stylua.toml diff --git a/.stylua.toml b/.stylua.toml deleted file mode 100644 index 3ae7657..0000000 --- a/.stylua.toml +++ /dev/null @@ -1,7 +0,0 @@ -column_width = 100 -line_endings = "Unix" -indent_type = "Tabs" -indent_width = 4 -quote_style = "AutoPreferDouble" -call_parentheses = "Always" -collapse_simple_statement = "Never" diff --git a/src/Array/difference.lua b/src/Array/difference.lua index 90c5ab5..c9fc993 100644 --- a/src/Array/difference.lua +++ b/src/Array/difference.lua @@ -1,9 +1,9 @@ --!strict local T = require(script.Parent.Parent.Types) -local toSet = require(script.Parent.toSet) -local toArray = require(script.Parent.Parent.Set.toArray) local setDifference = require(script.Parent.Parent.Set.difference) +local toArray = require(script.Parent.Parent.Set.toArray) +local toSet = require(script.Parent.toSet) --[=[ @function difference diff --git a/src/Array/differenceSymmetric.lua b/src/Array/differenceSymmetric.lua index 54e358b..f8c9163 100644 --- a/src/Array/differenceSymmetric.lua +++ b/src/Array/differenceSymmetric.lua @@ -1,9 +1,9 @@ --!strict local T = require(script.Parent.Parent.Types) -local toSet = require(script.Parent.toSet) -local toArray = require(script.Parent.Parent.Set.toArray) local setDifferenceSymmetric = require(script.Parent.Parent.Set.differenceSymmetric) +local toArray = require(script.Parent.Parent.Set.toArray) +local toSet = require(script.Parent.toSet) --[=[ @function differenceSymmetric diff --git a/src/Array/update.lua b/src/Array/update.lua index e3e96da..166df4b 100644 --- a/src/Array/update.lua +++ b/src/Array/update.lua @@ -1,8 +1,8 @@ --!strict local Sift = script.Parent.Parent -local Util = require(Sift.Util) local Copy = require(script.Parent.copy) +local Util = require(Sift.Util) type Callback = (index: number) -> T type Updater = (currentValue: T, index: number) -> T diff --git a/src/Array/zipAll.lua b/src/Array/zipAll.lua index 33612a2..a5454f0 100644 --- a/src/Array/zipAll.lua +++ b/src/Array/zipAll.lua @@ -1,8 +1,8 @@ --!strict local Sift = script.Parent.Parent -local Reduce = require(script.Parent.reduce) local None = require(Sift.None) +local Reduce = require(script.Parent.reduce) --[=[ @function zipAll diff --git a/src/Dictionary/freeze.lua b/src/Dictionary/freeze.lua index 3f32a46..74e3bb8 100644 --- a/src/Dictionary/freeze.lua +++ b/src/Dictionary/freeze.lua @@ -1,6 +1,6 @@ --!strict -local _T = require(script.Parent.Parent.Types) local Copy = require(script.Parent.copy) +local _T = require(script.Parent.Parent.Types) --[=[ @function freeze diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..d667936 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,4 @@ +column_width = 100 + +[sort_requires] +enabled = true From b2b9b13b526f4759d64214afc93e47b08e61a6b5 Mon Sep 17 00:00:00 2001 From: supertree-wook Date: Wed, 5 Jun 2024 11:52:27 +0900 Subject: [PATCH 3/4] Cleanup --- src/Array/difference.lua | 14 +++++++------- src/Array/difference.spec.lua | 8 ++++---- src/Array/differenceSymmetric.lua | 14 +++++++------- src/Array/differenceSymmetric.spec.lua | 8 ++++---- src/Array/toSet.lua | 1 + src/Dictionary/mergeDeep.lua | 4 ++-- src/Dictionary/removeKey.lua | 4 ++-- src/Dictionary/removeKeys.lua | 4 ++-- src/Dictionary/set.lua | 4 ++-- src/Dictionary/update.lua | 4 ++-- src/Set/add.spec.lua | 6 +++--- src/Set/copy.lua | 4 ++-- src/Set/copy.spec.lua | 4 ++-- src/Set/count.spec.lua | 6 +++--- src/Set/delete.spec.lua | 6 +++--- src/Set/difference.spec.lua | 8 ++++---- src/Set/differenceSymmetric.spec.lua | 8 ++++---- src/Set/filter.spec.lua | 6 +++--- src/Set/fromArray.spec.lua | 4 ++-- src/Set/has.spec.lua | 6 +++--- src/Set/intersection.spec.lua | 4 ++-- src/Set/isSubset.spec.lua | 6 +++--- src/Set/isSuperset.spec.lua | 6 +++--- src/Set/map.spec.lua | 6 +++--- src/Set/merge.spec.lua | 8 ++++---- src/Set/toArray.spec.lua | 6 +++--- 26 files changed, 80 insertions(+), 79 deletions(-) diff --git a/src/Array/difference.lua b/src/Array/difference.lua index c9fc993..6e926d3 100644 --- a/src/Array/difference.lua +++ b/src/Array/difference.lua @@ -1,9 +1,9 @@ --!strict local T = require(script.Parent.Parent.Types) -local setDifference = require(script.Parent.Parent.Set.difference) -local toArray = require(script.Parent.Parent.Set.toArray) -local toSet = require(script.Parent.toSet) +local SetDifference = require(script.Parent.Parent.Set.difference) +local ToArray = require(script.Parent.Parent.Set.toArray) +local ToSet = require(script.Parent.toSet) --[=[ @function difference @@ -23,7 +23,7 @@ local toSet = require(script.Parent.toSet) ``` ]=] local function difference(array: T.Array, ...: T.Array): T.Array - local arraySet = toSet(array) + local arraySet = ToSet(array) local otherSets = {} for _, nextArray in { ... } do @@ -31,12 +31,12 @@ local function difference(array: T.Array, ...: T.Array): T.Array continue end - table.insert(otherSets, toSet(nextArray)) + table.insert(otherSets, ToSet(nextArray)) end - local differenceSet = setDifference(arraySet, unpack(otherSets)) + local differenceSet = SetDifference(arraySet, unpack(otherSets)) - return toArray(differenceSet) + return ToArray(differenceSet) end return difference diff --git a/src/Array/difference.spec.lua b/src/Array/difference.spec.lua index 5ae04ab..9d5ede4 100644 --- a/src/Array/difference.spec.lua +++ b/src/Array/difference.spec.lua @@ -1,11 +1,11 @@ return function() - local difference = require(script.Parent.difference) + local Difference = require(script.Parent.difference) it("should return the difference between two arrays", function() local array = { "hello", "world" } local otherArray = { "cat", "dog", "hello" } - local newArray = difference(array, otherArray) + local newArray = Difference(array, otherArray) expect(newArray).to.be.a("table") expect(#newArray).to.equal(1) @@ -17,7 +17,7 @@ return function() local array = { "hello", "world" } local otherArray = { "cat", "dog", "hello" } - local newArray = difference(array, nil, otherArray) + local newArray = Difference(array, nil, otherArray) expect(newArray).to.be.a("table") expect(#newArray).to.equal(1) @@ -30,7 +30,7 @@ return function() local otherArray = { "cat", "dog", "hello" } local anotherArray = { "hello", "panda" } - local newArray = difference(array, otherArray, anotherArray) + local newArray = Difference(array, otherArray, anotherArray) expect(newArray).to.be.a("table") expect(#newArray).to.equal(1) diff --git a/src/Array/differenceSymmetric.lua b/src/Array/differenceSymmetric.lua index f8c9163..5b8617e 100644 --- a/src/Array/differenceSymmetric.lua +++ b/src/Array/differenceSymmetric.lua @@ -1,9 +1,9 @@ --!strict local T = require(script.Parent.Parent.Types) -local setDifferenceSymmetric = require(script.Parent.Parent.Set.differenceSymmetric) -local toArray = require(script.Parent.Parent.Set.toArray) -local toSet = require(script.Parent.toSet) +local SetDifferenceSymmetric = require(script.Parent.Parent.Set.differenceSymmetric) +local ToArray = require(script.Parent.Parent.Set.toArray) +local ToSet = require(script.Parent.toSet) --[=[ @function differenceSymmetric @@ -23,7 +23,7 @@ local toSet = require(script.Parent.toSet) ``` ]=] local function differenceSymmetric(array: T.Array, ...: T.Array): T.Array - local arraySet = toSet(array) + local arraySet = ToSet(array) local otherSets = {} for _, nextArray in { ... } do @@ -31,12 +31,12 @@ local function differenceSymmetric(array: T.Array, ...: T.Array): T.Arr continue end - table.insert(otherSets, toSet(nextArray)) + table.insert(otherSets, ToSet(nextArray)) end - local differenceSet = setDifferenceSymmetric(arraySet, unpack(otherSets)) + local differenceSet = SetDifferenceSymmetric(arraySet, unpack(otherSets)) - return toArray(differenceSet) + return ToArray(differenceSet) end return differenceSymmetric diff --git a/src/Array/differenceSymmetric.spec.lua b/src/Array/differenceSymmetric.spec.lua index c3b03da..54f8a1c 100644 --- a/src/Array/differenceSymmetric.spec.lua +++ b/src/Array/differenceSymmetric.spec.lua @@ -1,11 +1,11 @@ return function() - local differenceSymmetric = require(script.Parent.differenceSymmetric) + local DifferenceSymmetric = require(script.Parent.differenceSymmetric) it("should return the symmetric difference between two arrays", function() local array = { "hello", "world" } local otherArray = { "cat", "dog", "hello" } - local newArray = differenceSymmetric(array, otherArray) + local newArray = DifferenceSymmetric(array, otherArray) expect(newArray).to.be.a("table") expect(#newArray).to.equal(3) @@ -19,7 +19,7 @@ return function() local array = { "hello", "world" } local otherArray = { "cat", "dog", "hello" } - local newArray = differenceSymmetric(array, nil, otherArray) + local newArray = DifferenceSymmetric(array, nil, otherArray) expect(newArray).to.be.a("table") expect(#newArray).to.equal(3) @@ -34,7 +34,7 @@ return function() local otherArray = { "cat", "dog", "hello" } local anotherArray = { "hello", "panda" } - local newArray = differenceSymmetric(array, otherArray, anotherArray) + local newArray = DifferenceSymmetric(array, otherArray, anotherArray) expect(newArray).to.be.a("table") expect(#newArray).to.equal(4) diff --git a/src/Array/toSet.lua b/src/Array/toSet.lua index 205774e..da9ea2d 100644 --- a/src/Array/toSet.lua +++ b/src/Array/toSet.lua @@ -1,5 +1,6 @@ --!strict local Sift = script.Parent.Parent + local _T = require(Sift.Types) --[=[ diff --git a/src/Dictionary/mergeDeep.lua b/src/Dictionary/mergeDeep.lua index e0ba505..5aca63a 100644 --- a/src/Dictionary/mergeDeep.lua +++ b/src/Dictionary/mergeDeep.lua @@ -1,8 +1,8 @@ --!strict local Sift = script.Parent.Parent +local CopyDeep = require(script.Parent.copyDeep) local None = require(Sift.None) -local copyDeep = require(script.Parent.copyDeep) --[=[ @function mergeDeep @@ -40,7 +40,7 @@ local function mergeDeep(...: any): T result[key] = nil elseif type(value) == "table" then if result[key] == nil or type(result[key]) ~= "table" then - result[key] = copyDeep(value) + result[key] = CopyDeep(value) else result[key] = mergeDeep(result[key], value) end diff --git a/src/Dictionary/removeKey.lua b/src/Dictionary/removeKey.lua index 6659fac..1744d1c 100644 --- a/src/Dictionary/removeKey.lua +++ b/src/Dictionary/removeKey.lua @@ -1,5 +1,5 @@ --!strict -local copy = require(script.Parent.copy) +local Copy = require(script.Parent.copy) --[=[ @function removeKey @@ -19,7 +19,7 @@ local copy = require(script.Parent.copy) ``` ]=] local function removeKey(dictionary: { [K]: V }, key: K): { [K]: V } - local result = copy(dictionary) + local result = Copy(dictionary) result[key] = nil diff --git a/src/Dictionary/removeKeys.lua b/src/Dictionary/removeKeys.lua index 93ff109..469b333 100644 --- a/src/Dictionary/removeKeys.lua +++ b/src/Dictionary/removeKeys.lua @@ -1,5 +1,5 @@ --!strict -local copy = require(script.Parent.copy) +local Copy = require(script.Parent.copy) --[=[ @function removeKeys @@ -18,7 +18,7 @@ local copy = require(script.Parent.copy) ``` ]=] local function removeKeys(dictionary: { [K]: V }, ...: K): { [K]: V } - local result = copy(dictionary) + local result = Copy(dictionary) for _, key in ipairs({ ... }) do result[key] = nil diff --git a/src/Dictionary/set.lua b/src/Dictionary/set.lua index 9cd2d5e..42c59c3 100644 --- a/src/Dictionary/set.lua +++ b/src/Dictionary/set.lua @@ -1,5 +1,5 @@ --!strict -local copy = require(script.Parent.copy) +local Copy = require(script.Parent.copy) --[=[ @function set @@ -19,7 +19,7 @@ local copy = require(script.Parent.copy) ``` ]=] local function set(dictionary: { [K]: V }, key: K, value: V): { [K]: V } - local result = copy(dictionary) + local result = Copy(dictionary) result[key] = value diff --git a/src/Dictionary/update.lua b/src/Dictionary/update.lua index 1b1dee0..990a174 100644 --- a/src/Dictionary/update.lua +++ b/src/Dictionary/update.lua @@ -1,5 +1,5 @@ --!strict -local copy = require(script.Parent.copy) +local Copy = require(script.Parent.copy) --[=[ @function update @@ -33,7 +33,7 @@ local function update( updater: ((value: V, key: K) -> U)?, callback: ((key: K) -> C)? ): { [K]: V | U | C } - local result: { [K]: any } = copy(dictionary) + local result: { [K]: any } = Copy(dictionary) if result[key] then if updater then diff --git a/src/Set/add.spec.lua b/src/Set/add.spec.lua index 09ac8b3..1ff4fc0 100644 --- a/src/Set/add.spec.lua +++ b/src/Set/add.spec.lua @@ -1,10 +1,10 @@ return function() - local add = require(script.Parent.add) + local Add = require(script.Parent.add) it("should add values to a set", function() local set = { hello = true } - local newSet = add(set, "world") + local newSet = Add(set, "world") expect(newSet).to.be.a("table") @@ -15,7 +15,7 @@ return function() it("should not modify the original set", function() local set = { hello = true } - add(set, "world") + Add(set, "world") expect(set).to.be.a("table") diff --git a/src/Set/copy.lua b/src/Set/copy.lua index c074e8c..7f1b857 100644 --- a/src/Set/copy.lua +++ b/src/Set/copy.lua @@ -1,7 +1,7 @@ --!strict local Sift = script.Parent.Parent -local copy = require(Sift.Dictionary.copy) +local Copy = require(Sift.Dictionary.copy) --[=[ @function copy @@ -18,4 +18,4 @@ local copy = require(Sift.Dictionary.copy) local newSet = Copy(set) -- { hello = true } ``` ]=] -return copy +return Copy diff --git a/src/Set/copy.spec.lua b/src/Set/copy.spec.lua index 21e9dd0..9dbab2c 100644 --- a/src/Set/copy.spec.lua +++ b/src/Set/copy.spec.lua @@ -1,10 +1,10 @@ return function() - local copy = require(script.Parent.copy) + local Copy = require(script.Parent.copy) it("should copy a set", function() local set = { hello = true } - local newSet = copy(set) + local newSet = Copy(set) expect(newSet).to.be.a("table") expect(newSet).never.to.equal(set) diff --git a/src/Set/count.spec.lua b/src/Set/count.spec.lua index 14b5638..c117e55 100644 --- a/src/Set/count.spec.lua +++ b/src/Set/count.spec.lua @@ -1,16 +1,16 @@ return function() - local count = require(script.Parent.count) + local Count = require(script.Parent.count) it("should count the number of values in a set", function() local set = { hello = true, world = true } - expect(count(set)).to.equal(2) + expect(Count(set)).to.equal(2) end) it("should count the number of values in a set matching the predicate", function() local set = { hello = true, world = true } - expect(count(set, function(value) + expect(Count(set, function(value) return value == "hello" end)).to.equal(1) end) diff --git a/src/Set/delete.spec.lua b/src/Set/delete.spec.lua index 3ebb89d..6ba929b 100644 --- a/src/Set/delete.spec.lua +++ b/src/Set/delete.spec.lua @@ -1,10 +1,10 @@ return function() - local delete = require(script.Parent.delete) + local Delete = require(script.Parent.delete) it("should delete a value from a set", function() local set = { hello = true } - local newSet = delete(set, "hello") + local newSet = Delete(set, "hello") expect(newSet).to.be.a("table") expect(newSet).never.to.equal(set) @@ -15,7 +15,7 @@ return function() it("should not modify the original set", function() local set = { hello = true } - delete(set, "hello") + Delete(set, "hello") expect(set).to.be.a("table") expect(set.hello).to.equal(true) diff --git a/src/Set/difference.spec.lua b/src/Set/difference.spec.lua index eba8c07..16c2343 100644 --- a/src/Set/difference.spec.lua +++ b/src/Set/difference.spec.lua @@ -1,11 +1,11 @@ return function() - local difference = require(script.Parent.difference) + local Difference = require(script.Parent.difference) it("should return the difference between two sets", function() local set = { hello = true, world = true } local otherSet = { panda = true, cat = true } - local newSet = difference(set, otherSet) + local newSet = Difference(set, otherSet) expect(newSet).to.be.a("table") @@ -19,7 +19,7 @@ return function() local set = { hello = true, world = true } local otherSet = { panda = true, cat = true } - local newSet = difference(set, nil, otherSet) + local newSet = Difference(set, nil, otherSet) expect(newSet).to.be.a("table") expect(newSet.hello).to.equal(true) @@ -31,7 +31,7 @@ return function() local otherSet = { panda = true, cat = true } local anotherSet = { hello = true, panda = true } - local newSet = difference(set, otherSet, anotherSet) + local newSet = Difference(set, otherSet, anotherSet) expect(newSet).to.be.a("table") diff --git a/src/Set/differenceSymmetric.spec.lua b/src/Set/differenceSymmetric.spec.lua index 54a78d8..6fc6a49 100644 --- a/src/Set/differenceSymmetric.spec.lua +++ b/src/Set/differenceSymmetric.spec.lua @@ -1,11 +1,11 @@ return function() - local differenceSymmetric = require(script.Parent.differenceSymmetric) + local DifferenceSymmetric = require(script.Parent.differenceSymmetric) it("should return the symmetric difference between two sets", function() local set = { hello = true, world = true } local otherSet = { panda = true, cat = true } - local newSet = differenceSymmetric(set, otherSet) + local newSet = DifferenceSymmetric(set, otherSet) expect(newSet).to.be.a("table") @@ -19,7 +19,7 @@ return function() local set = { hello = true, world = true } local otherSet = { panda = true, cat = true } - local newSet = differenceSymmetric(set, nil, otherSet) + local newSet = DifferenceSymmetric(set, nil, otherSet) expect(newSet).to.be.a("table") expect(newSet.hello).to.equal(true) @@ -31,7 +31,7 @@ return function() local otherSet = { panda = true, cat = true } local anotherSet = { hello = true, panda = true } - local newSet = differenceSymmetric(set, otherSet, anotherSet) + local newSet = DifferenceSymmetric(set, otherSet, anotherSet) expect(newSet).to.be.a("table") diff --git a/src/Set/filter.spec.lua b/src/Set/filter.spec.lua index 6e76422..7fae569 100644 --- a/src/Set/filter.spec.lua +++ b/src/Set/filter.spec.lua @@ -1,10 +1,10 @@ return function() - local filter = require(script.Parent.filter) + local Filter = require(script.Parent.filter) it("should filter a set", function() local set = { hello = true, world = true } - local newSet = filter(set, function(value) + local newSet = Filter(set, function(value) return value ~= "hello" end) @@ -17,7 +17,7 @@ return function() it("should not modify the original set", function() local set = { hello = true } - filter(set, function(value) + Filter(set, function(value) return value ~= "hello" end) diff --git a/src/Set/fromArray.spec.lua b/src/Set/fromArray.spec.lua index 2dbc287..5cbee11 100644 --- a/src/Set/fromArray.spec.lua +++ b/src/Set/fromArray.spec.lua @@ -1,8 +1,8 @@ return function() - local fromArray = require(script.Parent.fromArray) + local FromArray = require(script.Parent.fromArray) it("should create a set from an array", function() - local set = fromArray({ "hello", "world" }) + local set = FromArray({ "hello", "world" }) expect(set).to.be.a("table") diff --git a/src/Set/has.spec.lua b/src/Set/has.spec.lua index 9023e63..4396d6c 100644 --- a/src/Set/has.spec.lua +++ b/src/Set/has.spec.lua @@ -1,10 +1,10 @@ return function() - local has = require(script.Parent.has) + local Has = require(script.Parent.has) it("should check if a value is in a set", function() local set = { hello = true } - expect(has(set, "hello")).to.equal(true) - expect(has(set, "world")).to.equal(false) + expect(Has(set, "hello")).to.equal(true) + expect(Has(set, "world")).to.equal(false) end) end diff --git a/src/Set/intersection.spec.lua b/src/Set/intersection.spec.lua index 2f23cfb..fc5f05a 100644 --- a/src/Set/intersection.spec.lua +++ b/src/Set/intersection.spec.lua @@ -1,11 +1,11 @@ return function() - local intersection = require(script.Parent.intersection) + local Intersection = require(script.Parent.intersection) it("should return the intersection of two sets", function() local set1 = { hello = true, world = true } local set2 = { world = true, cat = true } - local newSet = intersection(set1, set2) + local newSet = Intersection(set1, set2) expect(newSet).to.be.a("table") diff --git a/src/Set/isSubset.spec.lua b/src/Set/isSubset.spec.lua index 78d541f..75c3cfd 100644 --- a/src/Set/isSubset.spec.lua +++ b/src/Set/isSubset.spec.lua @@ -1,11 +1,11 @@ return function() - local isSubset = require(script.Parent.isSubset) + local IsSubset = require(script.Parent.isSubset) it("should check if a set is a subset of another set", function() local set = { hello = true, world = true } local otherSet = { hello = true } - expect(isSubset(otherSet, set)).to.equal(true) - expect(isSubset(set, otherSet)).to.equal(false) + expect(IsSubset(otherSet, set)).to.equal(true) + expect(IsSubset(set, otherSet)).to.equal(false) end) end diff --git a/src/Set/isSuperset.spec.lua b/src/Set/isSuperset.spec.lua index da25d55..a046235 100644 --- a/src/Set/isSuperset.spec.lua +++ b/src/Set/isSuperset.spec.lua @@ -1,11 +1,11 @@ return function() - local isSuperset = require(script.Parent.isSuperset) + local IsSuperset = require(script.Parent.isSuperset) it("should check if a set is a superset of another set", function() local set = { hello = true, world = true } local otherSet = { hello = true } - expect(isSuperset(set, otherSet)).to.equal(true) - expect(isSuperset(otherSet, set)).to.equal(false) + expect(IsSuperset(set, otherSet)).to.equal(true) + expect(IsSuperset(otherSet, set)).to.equal(false) end) end diff --git a/src/Set/map.spec.lua b/src/Set/map.spec.lua index 04e9c14..3213361 100644 --- a/src/Set/map.spec.lua +++ b/src/Set/map.spec.lua @@ -1,10 +1,10 @@ return function() - local map = require(script.Parent.map) + local Map = require(script.Parent.map) it("should map a set", function() local set = { hello = true, world = true } - local newSet = map(set, function(value) + local newSet = Map(set, function(value) return value .. "!" end) @@ -21,7 +21,7 @@ return function() it("should not modify the original set", function() local set = { hello = true } - map(set, function(value) + Map(set, function(value) return value .. "!" end) diff --git a/src/Set/merge.spec.lua b/src/Set/merge.spec.lua index 2f39f28..b5df2e9 100644 --- a/src/Set/merge.spec.lua +++ b/src/Set/merge.spec.lua @@ -1,11 +1,11 @@ return function() - local merge = require(script.Parent.merge) + local Merge = require(script.Parent.merge) it("should merge two sets", function() local set = { hello = true, world = true } local otherSet = { panda = true, cat = true } - local newSet = merge(set, otherSet) + local newSet = Merge(set, otherSet) expect(newSet).to.be.a("table") @@ -19,8 +19,8 @@ return function() local set = { hello = true, world = true } local otherSet = { panda = true, cat = true } - local newSet = merge(set, nil, otherSet) - local newSet2 = merge(nil, set, otherSet) + local newSet = Merge(set, nil, otherSet) + local newSet2 = Merge(nil, set, otherSet) expect(newSet).to.be.a("table") expect(newSet.hello).to.equal(true) diff --git a/src/Set/toArray.spec.lua b/src/Set/toArray.spec.lua index ee2e46b..0539b61 100644 --- a/src/Set/toArray.spec.lua +++ b/src/Set/toArray.spec.lua @@ -1,10 +1,10 @@ return function() - local toArray = require(script.Parent.toArray) + local ToArray = require(script.Parent.toArray) it("should convert a set to an array", function() local set = { hello = true, world = true } - local array = toArray(set) + local array = ToArray(set) expect(array).to.be.a("table") expect(array).never.to.equal(set) @@ -16,7 +16,7 @@ return function() it("should not modify the original set", function() local set = { hello = true } - toArray(set) + ToArray(set) expect(set).to.be.a("table") From 354bba27e3ad496ecb88c6459b42806036923447 Mon Sep 17 00:00:00 2001 From: supertree-wook Date: Wed, 5 Jun 2024 12:03:07 +0900 Subject: [PATCH 4/4] Fix selene lint --- src/Array/is.spec.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Array/is.spec.lua b/src/Array/is.spec.lua index a5b1603..0682639 100644 --- a/src/Array/is.spec.lua +++ b/src/Array/is.spec.lua @@ -5,6 +5,7 @@ return function() expect(isArray({})).to.equal(false) expect(isArray({ 1, 2, 3 })).to.equal(true) expect(isArray({ hello = "world" })).to.equal(false) + --selene: allow(mixed_table) expect(isArray({ 1, 2, hello = "world" })).to.equal(false) expect(isArray({ 1, 2, 3, nil, 5 })).to.equal(true) end)