@@ -43,6 +43,7 @@ export(coord_cartesian)
4343export(ggsave)
4444export(fortify)
4545export(scale_type)
46+ exportPattern("^[^\\.].*")
4647import(grid)
4748import(rlang)
4849importFrom(scales,alpha)
@@ -52,7 +53,7 @@ importFrom(stats,setNames)`));
5253 ctx . addRequests ( [ { request : 'file' , content : 'test.R' } ] ) ;
5354 ctx . resolvePreAnalysis ( ) ;
5455
55- describe . sequential ( 'Basic exports' , function ( ) {
56+ describe ( 'Basic exports' , function ( ) {
5657 test ( 'Functions are exported' , ( ) => {
5758 const deps = ctx . deps . getDependency ( 'current' ) ;
5859 assert . isDefined ( deps ) ;
@@ -74,9 +75,16 @@ importFrom(stats,setNames)`));
7475 assert . isTrue ( deps . namespaceInfo ?. exportedSymbols . includes ( 'coord_cartesian' ) ) ;
7576 assert . isTrue ( deps . namespaceInfo ?. exportedSymbols . includes ( 'ggsave' ) ) ;
7677 } ) ;
78+
79+ test ( 'Export pattern registered' , ( ) => {
80+ const deps = ctx . deps . getDependency ( 'current' ) ;
81+ assert . isDefined ( deps ) ;
82+ assert . strictEqual ( deps . namespaceInfo ?. exportedPatterns ?. length , 1 ) ;
83+ assert . strictEqual ( deps . namespaceInfo ?. exportedPatterns ?. [ 0 ] , '^[^\\.].*' ) ;
84+ } ) ;
7785 } ) ;
7886
79- describe . sequential ( 'S3 methods - fortify' , function ( ) {
87+ describe ( 'S3 methods - fortify' , function ( ) {
8088 test ( 'All fortify methods registered in namespaceInfo' , ( ) => {
8189 const deps = ctx . deps . getDependency ( 'current' ) ;
8290 assert . isDefined ( deps ) ;
@@ -100,7 +108,24 @@ importFrom(stats,setNames)`));
100108 } ) ;
101109 } ) ;
102110
103- describe . sequential ( 'Mixed exports and S3' , function ( ) {
111+ describe ( 'Correct Imports' , function ( ) {
112+ test ( 'Imports are registered correctly' , ( ) => {
113+ const deps = ctx . deps . getDependency ( 'current' ) ;
114+ assert . isDefined ( deps ) ;
115+
116+ assert . isTrue ( deps . namespaceInfo ?. importedPackages ?. has ( 'grid' ) ) ;
117+ assert . isTrue ( deps . namespaceInfo ?. importedPackages ?. has ( 'rlang' ) ) ;
118+ assert . isTrue ( deps . namespaceInfo ?. importedPackages ?. has ( 'scales' ) ) ;
119+ assert . isTrue ( deps . namespaceInfo ?. importedPackages ?. has ( 'stats' ) ) ;
120+
121+ assert . strictEqual ( deps . namespaceInfo ?. importedPackages ?. get ( 'grid' ) , 'all' ) ;
122+ assert . strictEqual ( deps . namespaceInfo ?. importedPackages ?. get ( 'rlang' ) , 'all' ) ;
123+ assert . deepEqual ( deps . namespaceInfo ?. importedPackages ?. get ( 'scales' ) , [ 'alpha' ] ) ;
124+ assert . deepEqual ( deps . namespaceInfo ?. importedPackages ?. get ( 'stats' ) , [ 'setNames' ] ) ;
125+ } ) ;
126+ } ) ;
127+
128+ describe ( 'Mixed exports and S3' , function ( ) {
104129 test ( 'ggplot has export and S3 method' , ( ) => {
105130 const deps = ctx . deps . getDependency ( 'current' ) ;
106131 assert . isDefined ( deps ) ;
0 commit comments