mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
refactor(output): share the JSON, created-resource and batch tails
Mutations end with a.jsonResult or a.created instead of hand-rolled --json branches, the two identical jsonResult/writeMutationJSON helpers become one, and writeBatchJSON checks --json itself so batch commands share one tail. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
32 files changed
+87
-217
No files matched your search
@@ -379,8 +379,12 @@ func TestMutationFeedback(t *testing.T) {
|
||||
ref := refLabel("alice/x", 12, "Fix\x1b[2J login")
|
||||
a.done(cmd, "Created issue %s", ref)
|
||||
a.warn(cmd, "Issue %s is already closed", ref)
|
||||
require.NoError(t, a.printURL(cmd, "https://example.org/12"))
|
||||
require.Equal(t, tc.out, out.String())
|
||||
require.NoError(t, a.created(cmd, map[string]int{"number": 12}, "https://example.org/12"))
|
||||
if tc.json != "" {
|
||||
require.JSONEq(t, `{"number":12}`, out.String())
|
||||
} else {
|
||||
require.Equal(t, tc.out, out.String())
|
||||
}
|
||||
require.Equal(t, tc.stderr, diagnostics.String())
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user