@@ -1491,6 +1491,54 @@ def test_collection_install__pathname_set
14911491 end
14921492 end
14931493
1494+ def test_collection_install__nongem_stdlib_no_warning
1495+ Dir . mktmpdir do |dir |
1496+ Dir . chdir ( dir ) do
1497+ dir = Pathname ( dir )
1498+ dir . join ( RBS ::Collection ::Config ::PATH ) . write ( <<~YAML )
1499+ sources:
1500+ - name: ruby/gem_rbs_collection
1501+ remote: https://github.com/ruby/gem_rbs_collection.git
1502+ revision: b4d3b346d9657543099a35a1fd20347e75b8c523
1503+ repo_dir: gems
1504+
1505+ path: #{ dir . join ( 'gem_rbs_collection' ) }
1506+
1507+ gems:
1508+ - name: socket
1509+ - name: pathname
1510+ YAML
1511+
1512+ bundle_install ( 'ast' , 'logger' , 'tsort' )
1513+
1514+ # First install creates the lockfile with socket as stdlib
1515+ _stdout , stderr = run_rbs_collection ( "install" , bundler : true )
1516+
1517+ lockfile = RBS ::Collection ::Config ::Lockfile . from_lockfile (
1518+ lockfile_path : dir + "rbs_collection.lock.yaml" ,
1519+ data : YAML . safe_load ( ( dir + "rbs_collection.lock.yaml" ) . read )
1520+ )
1521+
1522+ assert_instance_of RBS ::Collection ::Sources ::Stdlib , lockfile . gems [ "socket" ] [ :source ]
1523+ assert_instance_of RBS ::Collection ::Sources ::Stdlib , lockfile . gems [ "pathname" ] [ :source ]
1524+
1525+ # Second install with existing lockfile should not warn about nongem stdlibs
1526+ _stdout , stderr = run_rbs_collection ( "install" , bundler : true )
1527+
1528+ refute_match ( /Cannot find `socket` gem/ , stderr )
1529+ refute_match ( /Cannot find `pathname` gem/ , stderr )
1530+
1531+ lockfile = RBS ::Collection ::Config ::Lockfile . from_lockfile (
1532+ lockfile_path : dir + "rbs_collection.lock.yaml" ,
1533+ data : YAML . safe_load ( ( dir + "rbs_collection.lock.yaml" ) . read )
1534+ )
1535+
1536+ assert_instance_of RBS ::Collection ::Sources ::Stdlib , lockfile . gems [ "socket" ] [ :source ]
1537+ assert_instance_of RBS ::Collection ::Sources ::Stdlib , lockfile . gems [ "pathname" ] [ :source ]
1538+ end
1539+ end
1540+ end
1541+
14941542 def test_collection_install__set_pathname__manifest
14951543 Dir . mktmpdir do |dir |
14961544 Dir . chdir ( dir ) do
0 commit comments