MCPcopy
hub / github.com/cli/cli / TestParseCloneArgs

Function TestParseCloneArgs

git/client_test.go:1851–1901  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1849}
1850
1851func TestParseCloneArgs(t *testing.T) {
1852 type wanted struct {
1853 args []string
1854 dir string
1855 }
1856 tests := []struct {
1857 name string
1858 args []string
1859 want wanted
1860 }{
1861 {
1862 name: "args and target",
1863 args: []string{"target_directory", "-o", "upstream", "--depth", "1"},
1864 want: wanted{
1865 args: []string{"-o", "upstream", "--depth", "1"},
1866 dir: "target_directory",
1867 },
1868 },
1869 {
1870 name: "only args",
1871 args: []string{"-o", "upstream", "--depth", "1"},
1872 want: wanted{
1873 args: []string{"-o", "upstream", "--depth", "1"},
1874 dir: "",
1875 },
1876 },
1877 {
1878 name: "only target",
1879 args: []string{"target_directory"},
1880 want: wanted{
1881 args: []string{},
1882 dir: "target_directory",
1883 },
1884 },
1885 {
1886 name: "no args",
1887 args: []string{},
1888 want: wanted{
1889 args: []string{},
1890 dir: "",
1891 },
1892 },
1893 }
1894 for _, tt := range tests {
1895 t.Run(tt.name, func(t *testing.T) {
1896 args, dir := parseCloneArgs(tt.args)
1897 got := wanted{args: args, dir: dir}
1898 assert.Equal(t, got, tt.want)
1899 })
1900 }
1901}
1902
1903func TestClientAddRemote(t *testing.T) {
1904 tests := []struct {

Callers

nothing calls this directly

Calls 3

parseCloneArgsFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected