@@ -248,6 +248,52 @@ func TestCommandGet(t *testing.T) {
248248 t .Errorf ("silent mode should not output any logs, but got: %s" , out )
249249 }
250250 },
251+ }, {
252+ name : "[partial] blobless" ,
253+ scenario : func (t * testing.T , tmpRoot string , cloneArgs * _cloneArgs , updateArgs * _updateArgs ) {
254+ localDir := filepath .Join (tmpRoot , "github.com" , "motemen" , "ghq-test-repo" )
255+
256+ app .Run ([]string {"" , "get" , "--partial" , "blobless" , "motemen/ghq-test-repo" })
257+
258+ expect := "https://github.com/motemen/ghq-test-repo"
259+ if cloneArgs .remote .String () != expect {
260+ t .Errorf ("got: %s, expect: %s" , cloneArgs .remote , expect )
261+ }
262+ if filepath .ToSlash (cloneArgs .local ) != filepath .ToSlash (localDir ) {
263+ t .Errorf ("got: %s, expect: %s" , filepath .ToSlash (cloneArgs .local ), filepath .ToSlash (localDir ))
264+ }
265+ if cloneArgs .partial != "blobless" {
266+ t .Errorf ("cloneArgs.partial should be \" blobless\" " )
267+ }
268+ },
269+ }, {
270+ name : "[partial] treeless" ,
271+ scenario : func (t * testing.T , tmpRoot string , cloneArgs * _cloneArgs , updateArgs * _updateArgs ) {
272+ localDir := filepath .Join (tmpRoot , "github.com" , "motemen" , "ghq-test-repo" )
273+
274+ app .Run ([]string {"" , "get" , "--partial" , "treeless" , "motemen/ghq-test-repo" })
275+
276+ expect := "https://github.com/motemen/ghq-test-repo"
277+ if cloneArgs .remote .String () != expect {
278+ t .Errorf ("got: %s, expect: %s" , cloneArgs .remote , expect )
279+ }
280+ if filepath .ToSlash (cloneArgs .local ) != filepath .ToSlash (localDir ) {
281+ t .Errorf ("got: %s, expect: %s" , filepath .ToSlash (cloneArgs .local ), filepath .ToSlash (localDir ))
282+ }
283+ if cloneArgs .partial != "treeless" {
284+ t .Errorf ("cloneArgs.partial should be \" treeless\" " )
285+ }
286+ },
287+ }, {
288+ name : "[partial] unacceptable value" ,
289+ scenario : func (t * testing.T , tmpRoot string , cloneArgs * _cloneArgs , updateArgs * _updateArgs ) {
290+ err := app .Run ([]string {"" , "get" , "--partial" , "unacceptable" , "motemen/ghq-test-repo" })
291+
292+ expect := "flag partial value \" unacceptable\" is not allowed"
293+ if err .Error () != expect {
294+ t .Errorf ("got: %s, expect: %s" , err .Error (), expect )
295+ }
296+ },
251297 }}
252298
253299 for _ , tc := range testCases {
0 commit comments