@@ -407,6 +407,49 @@ func TestGitGetter_GetFile(t *testing.T) {
407
407
assertContents (t , dst , "hello" )
408
408
}
409
409
410
+ func TestGitGetter_githubGetWithFileMode (t * testing.T ) {
411
+ if ! testHasGit {
412
+ t .Skip ("git not found, skipping" )
413
+ }
414
+
415
+ dst := tempTestFile (t )
416
+ defer os .RemoveAll (filepath .Dir (dst ))
417
+
418
+ c := Client {
419
+ Src : "git::https://github.com/arikkfir/go-getter/testdata/basic/foo/main.tf?ref=master" ,
420
+ Dst : dst ,
421
+ Mode : ClientModeFile ,
422
+ }
423
+ if err := c .Get (); err != nil {
424
+ t .Fatalf ("err: %s" , err )
425
+ }
426
+
427
+ // Verify the main file exists
428
+ if _ , err := os .Stat (dst ); err != nil {
429
+ t .Fatalf ("err: %s" , err )
430
+ }
431
+ assertContents (t , dst , "# Hello\n " )
432
+ }
433
+
434
+ func TestGitGetter_githubGetFile (t * testing.T ) {
435
+ if ! testHasGit {
436
+ t .Skip ("git not found, skipping" )
437
+ }
438
+
439
+ dst := tempTestFile (t )
440
+ defer os .RemoveAll (filepath .Dir (dst ))
441
+
442
+ if err := GetFile (dst , "git::https://github.com/arikkfir/go-getter/testdata/basic/foo/main.tf?ref=master" ); err != nil {
443
+ t .Fatalf ("err: %s" , err )
444
+ }
445
+
446
+ // Verify the main file exists
447
+ if _ , err := os .Stat (dst ); err != nil {
448
+ t .Fatalf ("err: %s" , err )
449
+ }
450
+ assertContents (t , dst , "# Hello\n " )
451
+ }
452
+
410
453
func TestGitGetter_gitVersion (t * testing.T ) {
411
454
if ! testHasGit {
412
455
t .Skip ("git not found, skipping" )
0 commit comments