Skip to content

Commit d4522df

Browse files
committed
test(dunder): flip calculate and expected
1 parent 852ea2f commit d4522df

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

spec/path_dunder_spec.lua

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ describe("Test Dunder Methods of Path Object;", function()
2323
local foo = Posix.new("./folder/foo.txt")
2424
describe("__tostring", function()
2525
it("()", function()
26-
assert.are.equal(tostring(foo), "folder/foo.txt")
27-
assert.are_not.equal(tostring(foo), "/folder/foo.txt")
26+
assert.are.equal("folder/foo.txt", tostring(foo))
27+
assert.are_not.equal("/folder/foo.txt", tostring(foo))
2828
local windows = Windows.new([[C:\hoge\fuga.txt]])
29-
assert.are.equal(tostring(windows), [[C:\hoge\fuga.txt]])
29+
assert.are.equal([[C:\hoge\fuga.txt]], tostring(windows))
3030
end)
3131
end)
3232

3333
describe("__eq", function()
3434
it("()", function()
3535
foo.__string_cache = nil
36-
assert.are.equal(foo, Posix.new("./folder/foo.txt")) -- "./" does not matter
37-
assert.are.equal(foo, Posix.new("folder/foo.txt"))
38-
assert.are_not.equal(foo, Posix.new("foo.txt"))
39-
assert.are_not.equal(foo, Posix.new("/folder/foo.txt"))
36+
assert.are.equal(Posix.new("./folder/foo.txt"), foo) -- "./" does not matter
37+
assert.are.equal(Posix.new("folder/foo.txt"), foo)
38+
assert.are_not.equal(Posix.new("foo.txt"), foo)
39+
assert.are_not.equal(Posix.new("/folder/foo.txt"), foo)
4040
end)
4141
end)
4242

@@ -61,9 +61,9 @@ describe("Test Dunder Methods of Path Object;", function()
6161

6262
describe("__div", function()
6363
it("()", function()
64-
assert.are.equal(foo, Posix.new(".") / "folder" / "foo.txt")
65-
assert.are.equal(foo, Posix.new("folder") / "foo.txt")
66-
assert.are.equal(foo, Posix.new(".") / Posix.new("./") / Posix.new("./folder") / "foo.txt")
64+
assert.are.equal(Posix.new(".") / "folder" / "foo.txt", foo)
65+
assert.are.equal(Posix.new("folder") / "foo.txt", foo)
66+
assert.are.equal(Posix.new(".") / Posix.new("./") / Posix.new("./folder") / "foo.txt", foo)
6767
-- Path.new(".") many times is OK
6868
end)
6969

@@ -78,7 +78,7 @@ describe("Test Dunder Methods of Path Object;", function()
7878
it("()", function()
7979
local file = Posix.new("./folder")
8080
assert.are.equal("folder/foo/bar", file .. "/foo/bar")
81-
assert.are.equal(tostring(file) .. "/foo/bar", file .. "/foo/bar")
81+
assert.are.equal(file .. "/foo/bar", tostring(file) .. "/foo/bar")
8282
end)
8383

8484
it("raise error", function()

0 commit comments

Comments
 (0)