Skip to content

Commit 6c7297b

Browse files
committed
test: 🔧 added PackageFile
1 parent f621b71 commit 6c7297b

File tree

6 files changed

+28
-14
lines changed

6 files changed

+28
-14
lines changed

TestSuite-lib

package.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
local spath =
2+
debug.getinfo(1,'S').source:sub(2):gsub("/+", "/"):gsub("[^/]*$","")
3+
package.path = spath.."?.lua;"
4+
..spath.."inventory/?.lua;"
5+
..package.path
6+
7+
require(spath.."TestSuite-lib/package")

peripheral.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ to simulate the normal behavior of a turtle interacting with a peripheral.
4141
--#endregion
4242

4343
---@type Vector
44-
local vector = require("./TestSuite-lib/vector/vector")
44+
local vector = require("vector")
4545

4646
local relativePositionOptions = {
4747
["right"] = true,

tests/test_spec.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,17 @@
2929
---@field equal function
3030
assert = assert
3131

32+
local spath =
33+
debug.getinfo(1,'S').source:sub(2):gsub("/+", "/"):gsub("[^/]*$",""):gsub("/tests", ""):gsub("tests", "")
34+
if spath == "" then
35+
spath = "./"
36+
end
37+
require(spath .. "package")
38+
3239
-- load the other suits
33-
local vector = require("./TestSuite-lib/vector/vector")
40+
local vector = require("vector")
3441

35-
local turtleEmulator = require("../turtleEmulator")
42+
local turtleEmulator = require("turtleEmulator")
3643
describe("Disabled Movement", function()
3744
local turtle
3845
setup(function()

turtleEmulator.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
--#endregion
3333

3434
---@type TurtleMock
35-
local turtleM = require("./turtleMock")
36-
local defaultInteration = require("../defaultInteraction")
37-
local defaultcheckActionValid = require("./defaultcheckActionValid")
38-
local chestInventory = require("./inventory/chestInventory")
35+
local turtleM = require("turtleMock")
36+
local defaultInteration = require("defaultInteraction")
37+
local defaultcheckActionValid = require("defaultcheckActionValid")
38+
local chestInventory = require("chestInventory")
3939
---@type Vector
40-
local vector = require("./TestSuite-lib/vector/vector")
40+
local vector = require("vector")
4141

4242
---comment
4343
---@param position Vector

turtleMock.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@
7070

7171

7272

73-
local peripheral = require("../peripheral")
74-
local defaultInteraction = require("../defaultInteraction")
75-
local turtleInventory = require("../inventory/turtleInventory")
73+
local peripheral = require("peripheral")
74+
local defaultInteraction = require("defaultInteraction")
75+
local turtleInventory = require("turtleInventory")
7676
---@type Vector
77-
local vector = require("./TestSuite-lib/vector/vector")
78-
local deepCopy = require("./TestSuite-lib/helperFunctions/helperFunctions").deepCopy
77+
local vector = require("vector")
78+
local deepCopy = require("helperFunctions").deepCopy
7979

8080
--- this class should not be used directly, use the createMock of the turtleEmulator function instead, which will set the proxy
8181
---@type TurtleMock

0 commit comments

Comments
 (0)