@@ -634,21 +634,13 @@ It returns the number of bytes written and any write error encountered.
634
634
} ) ;
635
635
636
636
test ( 'Replace vendor packages with relative path' , async ( ) => {
637
- // This test needs a go project that has vendor folder and vendor packages
638
- // Since the Go extension takes a dependency on the godef tool at github.com/rogpeppe/godef
639
- // which has vendor packages, we are using it here to test the "replace vendor packages with relative path" feature.
640
- // If the extension ever stops depending on godef tool or if godef ever stops having vendor packages, then this test
641
- // will fail and will have to be replaced with any other go project with vendor packages
642
-
643
637
const vendorSupport = await isVendorSupported ( ) ;
644
- const filePath = path . join ( toolsGopath , 'src ' , 'github.com' , 'rogpeppe' , 'godef' , 'go' , 'ast' , 'ast .go') ;
638
+ const filePath = path . join ( fixturePath , 'vendoring ' , 'main .go' ) ;
645
639
const workDir = path . dirname ( filePath ) ;
646
640
const vendorPkgsFullPath = [
647
- 'github.com/rogpeppe/godef/vendor/9fans.net/go/acme' ,
648
- 'github.com/rogpeppe/godef/vendor/9fans.net/go/plan9' ,
649
- 'github.com/rogpeppe/godef/vendor/9fans.net/go/plan9/client'
641
+ 'test/testfixture/vendoring/vendor/example.com/vendorpls' ,
650
642
] ;
651
- const vendorPkgsRelativePath = [ '9fans.net/go/acme' , '9fans.net/go/plan9' , '9fans.net/go/plan9/client '] ;
643
+ const vendorPkgsRelativePath = [ 'example.com/vendorpls ' ] ;
652
644
653
645
const gopkgsPromise = getAllPackages ( workDir ) . then ( ( pkgMap ) => {
654
646
const pkgs = Array . from ( pkgMap . keys ( ) ) . filter ( ( p ) => {
@@ -702,18 +694,10 @@ It returns the number of bytes written and any write error encountered.
702
694
} ) ;
703
695
704
696
test ( 'Vendor pkgs from other projects should not be allowed to import' , async ( ) => {
705
- // This test needs a go project that has vendor folder and vendor packages
706
- // Since the Go extension takes a dependency on the godef tool at github.com/rogpeppe/godef
707
- // which has vendor packages, we are using it here to test the "replace vendor packages with relative path" feature.
708
- // If the extension ever stops depending on godef tool or if godef ever stops having vendor packages, then this test
709
- // will fail and will have to be replaced with any other go project with vendor packages
710
-
711
697
const vendorSupport = await isVendorSupported ( ) ;
712
- const filePath = path . join ( toolsGopath , 'src ' , 'github.com' , 'ramya-rao-a' , 'go-outline' , 'main .go') ;
698
+ const filePath = path . join ( fixturePath , 'baseTest ' , 'test .go' ) ;
713
699
const vendorPkgs = [
714
- 'github.com/rogpeppe/godef/vendor/9fans.net/go/acme' ,
715
- 'github.com/rogpeppe/godef/vendor/9fans.net/go/plan9' ,
716
- 'github.com/rogpeppe/godef/vendor/9fans.net/go/plan9/client'
700
+ 'test/testfixture/vendoring/vendor/example.com/vendorpls' ,
717
701
] ;
718
702
719
703
const gopkgsPromise = new Promise < void > ( ( resolve , reject ) => {
@@ -757,13 +741,7 @@ It returns the number of bytes written and any write error encountered.
757
741
} ) ;
758
742
759
743
test ( 'Workspace Symbols' , ( ) => {
760
- // This test needs a go project that has vendor folder and vendor packages
761
- // Since the Go extension takes a dependency on the godef tool at github.com/rogpeppe/godef
762
- // which has vendor packages, we are using it here to test the "replace vendor packages with relative path" feature.
763
- // If the extension ever stops depending on godef tool or if godef ever stops having vendor packages, then this test
764
- // will fail and will have to be replaced with any other go project with vendor packages
765
-
766
- const workspacePath = path . join ( toolsGopath , 'src' , 'github.com' , 'rogpeppe' , 'godef' ) ;
744
+ const workspacePath = path . join ( fixturePath , 'vendoring' ) ;
767
745
const configWithoutIgnoringFolders = Object . create ( vscode . workspace . getConfiguration ( 'go' ) , {
768
746
gotoSymbol : {
769
747
value : {
@@ -795,16 +773,16 @@ It returns the number of bytes written and any write error encountered.
795
773
796
774
const withoutIgnoringFolders = getWorkspaceSymbols (
797
775
workspacePath ,
798
- 'WinInfo ' ,
776
+ 'SomethingStr ' ,
799
777
dummyCancellationSource . token ,
800
778
configWithoutIgnoringFolders
801
779
) . then ( ( results ) => {
802
- assert . equal ( results [ 0 ] . name , 'WinInfo ' ) ;
803
- assert . equal ( results [ 0 ] . path , path . join ( workspacePath , 'vendor/9fans.net/go/acme/acme .go' ) ) ;
780
+ assert . equal ( results [ 0 ] . name , 'SomethingStrange ' ) ;
781
+ assert . equal ( results [ 0 ] . path , path . join ( workspacePath , 'vendor/example.com/vendorpls/lib .go' ) ) ;
804
782
} ) ;
805
783
const withIgnoringFolders = getWorkspaceSymbols (
806
784
workspacePath ,
807
- 'WinInfo ' ,
785
+ 'SomethingStr ' ,
808
786
dummyCancellationSource . token ,
809
787
configWithIgnoringFolders
810
788
) . then ( ( results ) => {
0 commit comments