mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix: address verified review findings (cli-core-1)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
12 files changed
+181
-21
No files matched your search
@@ -84,6 +84,14 @@ func TestAliasesAfterGlobalFlagsAndNestedHelp(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBareJSONBeforeAnAliasKeepsTheAlias(t *testing.T) {
|
||||
deps, out, _ := testDeps(t)
|
||||
require.NoError(t, Execute(context.Background(), deps, []string{"alias", "set", "prefs", "config list"}))
|
||||
out.Reset()
|
||||
require.NoError(t, Execute(context.Background(), deps, []string{"--json", "prefs"}))
|
||||
require.Contains(t, out.String(), "git_protocol")
|
||||
}
|
||||
|
||||
func TestJoinJSONFields(t *testing.T) {
|
||||
for _, tc := range []struct{ args, want []string }{
|
||||
{[]string{"issue", "list", "--json", "number,title"}, []string{"issue", "list", "--json=number,title"}},
|
||||
@@ -101,6 +109,7 @@ func TestJoinJSONFields(t *testing.T) {
|
||||
// A leading --json keeps the command word that follows it.
|
||||
{[]string{"--json", "repo", "view", "alice/project"}, []string{"--json", "repo", "view", "alice/project"}},
|
||||
{[]string{"--json", "pr", "list"}, []string{"--json", "pr", "list"}},
|
||||
{[]string{"issue", "--json", "list"}, []string{"issue", "--json", "list"}},
|
||||
{[]string{"--json", "number", "my-alias"}, []string{"--json=number", "my-alias"}},
|
||||
// A word that cannot be an argument is a misspelled field, which then lists the available ones.
|
||||
{[]string{"issue", "list", "--json", "Number"}, []string{"issue", "list", "--json=Number"}},
|
||||
|
||||
Reference in new issue
Block a user