MCPcopy Create free account
hub / github.com/cli/cli / TestParseCloneArgs

Function TestParseCloneArgs

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

parseCloneArgsFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected