chore: apply formatting
This commit is contained in:
+30
-19
@@ -1,5 +1,5 @@
|
||||
local t = require("test")
|
||||
local status = require("git.core.status")
|
||||
local t = require("test")
|
||||
|
||||
local NUL = "\0"
|
||||
|
||||
@@ -204,7 +204,10 @@ t.test("mark_for: changed staged modified", function()
|
||||
path = "x",
|
||||
staged = "modified",
|
||||
}
|
||||
t.eq(status.mark_for(entry, "staged"), { char = "M", hl = "GitStagedModified" })
|
||||
t.eq(
|
||||
status.mark_for(entry, "staged"),
|
||||
{ char = "M", hl = "GitStagedModified" }
|
||||
)
|
||||
end)
|
||||
|
||||
t.test("mark_for: changed unstaged deleted uses GitUnstagedDeleted", function()
|
||||
@@ -213,7 +216,10 @@ t.test("mark_for: changed unstaged deleted uses GitUnstagedDeleted", function()
|
||||
path = "x",
|
||||
unstaged = "deleted",
|
||||
}
|
||||
t.eq(status.mark_for(entry, "unstaged"), { char = "D", hl = "GitUnstagedDeleted" })
|
||||
t.eq(
|
||||
status.mark_for(entry, "unstaged"),
|
||||
{ char = "D", hl = "GitUnstagedDeleted" }
|
||||
)
|
||||
end)
|
||||
|
||||
t.test("mark_for: changed renamed uses per-side renamed hl", function()
|
||||
@@ -223,7 +229,10 @@ t.test("mark_for: changed renamed uses per-side renamed hl", function()
|
||||
staged = "renamed",
|
||||
orig = "y",
|
||||
}
|
||||
t.eq(status.mark_for(entry, "staged"), { char = "R", hl = "GitStagedRenamed" })
|
||||
t.eq(
|
||||
status.mark_for(entry, "staged"),
|
||||
{ char = "R", hl = "GitStagedRenamed" }
|
||||
)
|
||||
end)
|
||||
|
||||
t.test("mark_for: untracked / ignored / unmerged ignore side", function()
|
||||
@@ -364,24 +373,26 @@ t.test("entry_equal: differing unmerged conflict returns false", function()
|
||||
t.falsy(status.entry_equal(a, b))
|
||||
end)
|
||||
|
||||
t.test("diff_entries: detects additions, removals, and modifications", function()
|
||||
local prior = {
|
||||
a = { kind = "changed", path = "a", staged = "modified" },
|
||||
b = { kind = "untracked", path = "b" },
|
||||
}
|
||||
local next_ = {
|
||||
a = { kind = "changed", path = "a", staged = "added" },
|
||||
c = { kind = "untracked", path = "c" },
|
||||
}
|
||||
local changed = status.diff_entries(prior, next_)
|
||||
t.truthy(changed.a, "a modified")
|
||||
t.truthy(changed.b, "b removed")
|
||||
t.truthy(changed.c, "c added")
|
||||
end)
|
||||
t.test(
|
||||
"diff_entries: detects additions, removals, and modifications",
|
||||
function()
|
||||
local prior = {
|
||||
a = { kind = "changed", path = "a", staged = "modified" },
|
||||
b = { kind = "untracked", path = "b" },
|
||||
}
|
||||
local next_ = {
|
||||
a = { kind = "changed", path = "a", staged = "added" },
|
||||
c = { kind = "untracked", path = "c" },
|
||||
}
|
||||
local changed = status.diff_entries(prior, next_)
|
||||
t.truthy(changed.a, "a modified")
|
||||
t.truthy(changed.b, "b removed")
|
||||
t.truthy(changed.c, "c added")
|
||||
end
|
||||
)
|
||||
|
||||
t.test("diff_entries: empty when entries match", function()
|
||||
local prior = { a = { kind = "untracked", path = "a" } }
|
||||
local next_ = { a = { kind = "untracked", path = "a" } }
|
||||
t.eq(status.diff_entries(prior, next_), {})
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user