Skip to content

Commit 62dae8a

Browse files
committed
style(spec): use path aliases in fs spec
1 parent 048fe8d commit 62dae8a

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

spec/fs_spec.lua

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe("mods.fs", function()
9393
end)
9494

9595
it("fails with an error when the parent directory does not exist", function()
96-
local target = path.join(tmpname(), "missing", "file.bin")
96+
local target = join(tmpname(), "missing", "file.bin")
9797
local ok, errmsg, errcode = fs.write_bytes(target, "abc")
9898
assert.is_nil(ok)
9999
assert.is_string(errmsg)
@@ -110,7 +110,7 @@ describe("mods.fs", function()
110110
end)
111111

112112
it("fails with an error when the parent directory does not exist", function()
113-
local target = path.join(tmpname(), "missing", "file.txt")
113+
local target = join(tmpname(), "missing", "file.txt")
114114
local ok, errmsg, errcode = fs.write_text(target, "abc")
115115
assert.is_nil(ok)
116116
assert.is_string(errmsg)
@@ -177,7 +177,7 @@ describe("mods.fs", function()
177177

178178
it("fails when the parent directory does not exist", function()
179179
local root = tmpname()
180-
local target = path.join(root, "missing", "file.txt")
180+
local target = join(root, "missing", "file.txt")
181181
local ok, errmsg, errcode = fs.touch(target)
182182
assert.is_nil(ok)
183183
assert.is_string(errmsg)
@@ -212,7 +212,7 @@ describe("mods.fs", function()
212212
describe("mkdir()", function()
213213
it("creates a directory without parent mode", function()
214214
local root = make_tmp_dir()
215-
local target = path.join(root, "single")
215+
local target = join(root, "single")
216216

217217
assert.is_true(fs.mkdir(target))
218218
assert.is_true(fs.exists(target))
@@ -222,10 +222,10 @@ describe("mods.fs", function()
222222

223223
it("creates missing parent directories when parent mode is enabled", function()
224224
local root = make_tmp_dir()
225-
local target = path.join(root, "deep", "child")
225+
local target = join(root, "deep", "child")
226226

227227
assert.is_true(fs.mkdir(target, true))
228-
assert.is_true(fs.exists(path.dirname(target)))
228+
assert.is_true(fs.exists(dirname(target)))
229229
assert.is_true(fs.exists(target))
230230
assert.is_true(isdir(target))
231231
assert.is_true(fs.rm(root, true))
@@ -241,18 +241,18 @@ describe("mods.fs", function()
241241

242242
it("normalizes dot segments before creating parent directories", function()
243243
local root = make_tmp_dir()
244-
local target = path.join(root, "alpha", "..", "beta", ".", "child")
245-
local normalized = path.join(root, "beta", "child")
244+
local target = join(root, "alpha", "..", "beta", ".", "child")
245+
local normalized = join(root, "beta", "child")
246246

247247
assert.is_true(fs.mkdir(target, true))
248-
assert.is_false(fs.exists(path.join(root, "alpha")))
248+
assert.is_false(fs.exists(join(root, "alpha")))
249249
assert.is_true(fs.exists(normalized))
250250
assert.is_true(isdir(normalized))
251251
assert.is_true(fs.rm(root, true))
252252
end)
253253

254254
it("fails when parent directories are missing without parent mode", function()
255-
local target = path.join(tmpname(), "missing", "child")
255+
local target = join(tmpname(), "missing", "child")
256256
local ok, errmsg, errcode = fs.mkdir(target)
257257
assert.is_nil(ok)
258258
assert.is_string(errmsg)
@@ -261,8 +261,8 @@ describe("mods.fs", function()
261261

262262
it("fails when a parent path component is a file", function()
263263
local root = make_tmp_dir()
264-
local parent_file = path.join(root, "data.txt")
265-
local target = path.join(parent_file, "child")
264+
local parent_file = join(root, "data.txt")
265+
local target = join(parent_file, "child")
266266

267267
assert.is_true(fs.write_text(parent_file, "abc"))
268268

@@ -275,7 +275,7 @@ describe("mods.fs", function()
275275

276276
it("fails when the target path already exists as a file", function()
277277
local root = make_tmp_dir()
278-
local target = path.join(root, "data.txt")
278+
local target = join(root, "data.txt")
279279

280280
assert.is_true(fs.write_text(target, "abc"))
281281

@@ -478,7 +478,7 @@ describe("mods.fs", function()
478478

479479
it("fails with an error for a non-empty directory without recursive mode", function()
480480
local root = make_tmp_dir()
481-
local target = path.join(root, "data.txt")
481+
local target = join(root, "data.txt")
482482

483483
assert.is_true(fs.write_text(target, "abc"))
484484

@@ -519,7 +519,7 @@ describe("mods.fs", function()
519519
local tree = Tree():dir("sub"):dir(join("sub", "deep")):file("data.txt"):file(join("sub", "deep", "nested.txt"))
520520
local root = tree.root
521521
local target = tree:path("data.txt")
522-
local nested = tree:path(path.join("sub", "deep", "nested.txt"))
522+
local nested = tree:path(join("sub", "deep", "nested.txt"))
523523

524524
assert.is_true(fs.exists(root))
525525
assert.is_true(fs.exists(target))
@@ -535,7 +535,7 @@ describe("mods.fs", function()
535535
if is_unix then
536536
it("removes a symlink root without deleting the target directory", function()
537537
local external = make_tmp_dir()
538-
local external_file = path.join(external, "nested.txt")
538+
local external_file = join(external, "nested.txt")
539539

540540
assert.is_true(fs.write_text(external_file, "abc"))
541541

@@ -557,8 +557,8 @@ describe("mods.fs", function()
557557
it("does not follow symlinked directories during recursive removal", function()
558558
local root = make_tmp_dir()
559559
local external = make_tmp_dir()
560-
local external_file = path.join(external, "nested.txt")
561-
local link_dir = path.join(root, "linked")
560+
local external_file = join(external, "nested.txt")
561+
local link_dir = join(root, "linked")
562562

563563
assert.is_true(fs.write_text(external_file, "abc"))
564564

@@ -634,8 +634,8 @@ describe("mods.fs", function()
634634
if is_unix then
635635
it("returns true for a hard link to the same file", function()
636636
local root = tmpname()
637-
local target = path.join(root, "target.txt")
638-
local link = path.join(root, "hardlink.txt")
637+
local target = join(root, "target.txt")
638+
local link = join(root, "hardlink.txt")
639639

640640
assert.is_true(lfs.mkdir(root))
641641

0 commit comments

Comments
 (0)