File tree Expand file tree Collapse file tree 5 files changed +128
-0
lines changed Expand file tree Collapse file tree 5 files changed +128
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,8 @@ The output has the following format:
180180 " categories" : [
181181 " command-line-utilities"
182182 ],
183+ /* Optional string that is the default binary picked by cargo run. */
184+ " default_run" : null ,
183185 /* Array of keywords from the manifest. */
184186 " keywords" : [
185187 " cli"
Original file line number Diff line number Diff line change @@ -175,6 +175,8 @@ OUTPUT FORMAT
175175 "categories": [
176176 "command-line-utilities"
177177 ],
178+ /* Optional string that is the default binary picked by cargo run. */
179+ "default_run": null,
178180 /* Array of keywords from the manifest. */
179181 "keywords": [
180182 "cli"
Original file line number Diff line number Diff line change @@ -180,6 +180,8 @@ The output has the following format:
180180 " categories" : [
181181 " command-line-utilities"
182182 ],
183+ /* Optional string that is the default binary picked by cargo run. */
184+ " default_run" : null ,
183185 /* Array of keywords from the manifest. */
184186 " keywords" : [
185187 " cli"
Original file line number Diff line number Diff line change @@ -177,6 +177,8 @@ The output has the following format:
177177 "categories": [
178178 "command\- line\- utilities"
179179 ],
180+ /* Optional string that is the default binary picked by cargo run. */
181+ "default_run": null,
180182 /* Array of keywords from the manifest. */
181183 "keywords": [
182184 "cli"
Original file line number Diff line number Diff line change @@ -1532,6 +1532,126 @@ fn package_edition_2018() {
15321532 . run ( ) ;
15331533}
15341534
1535+ #[ cargo_test]
1536+ fn package_default_run ( ) {
1537+ let p = project ( )
1538+ . file ( "src/lib.rs" , "" )
1539+ . file ( "src/bin/a.rs" , r#"fn main() { println!("hello A"); }"# )
1540+ . file ( "src/bin/b.rs" , r#"fn main() { println!("hello B"); }"# )
1541+ . file (
1542+ "Cargo.toml" ,
1543+ r#"
1544+ [project]
1545+ name = "foo"
1546+ version = "0.1.0"
1547+ authors = ["wycats@example.com"]
1548+ edition = "2018"
1549+ default-run = "a"
1550+ "# ,
1551+ )
1552+ . build ( ) ;
1553+ p. cargo ( "metadata" )
1554+ . with_json (
1555+ r#"
1556+ {
1557+ "packages": [
1558+ {
1559+ "authors": [
1560+ "wycats@example.com"
1561+ ],
1562+ "categories": [],
1563+ "default_run": "a",
1564+ "dependencies": [],
1565+ "description": null,
1566+ "edition": "2018",
1567+ "features": {},
1568+ "id": "foo 0.1.0 (path+file:[..])",
1569+ "keywords": [],
1570+ "license": null,
1571+ "license_file": null,
1572+ "links": null,
1573+ "manifest_path": "[..]Cargo.toml",
1574+ "metadata": null,
1575+ "publish": null,
1576+ "name": "foo",
1577+ "readme": null,
1578+ "repository": null,
1579+ "homepage": null,
1580+ "documentation": null,
1581+ "source": null,
1582+ "targets": [
1583+ {
1584+ "crate_types": [
1585+ "lib"
1586+ ],
1587+ "doc": true,
1588+ "doctest": true,
1589+ "test": true,
1590+ "edition": "2018",
1591+ "kind": [
1592+ "lib"
1593+ ],
1594+ "name": "foo",
1595+ "src_path": "[..]src/lib.rs"
1596+ },
1597+ {
1598+ "crate_types": [
1599+ "bin"
1600+ ],
1601+ "doc": true,
1602+ "doctest": false,
1603+ "test": true,
1604+ "edition": "2018",
1605+ "kind": [
1606+ "bin"
1607+ ],
1608+ "name": "a",
1609+ "src_path": "[..]src/bin/a.rs",
1610+ "test": true
1611+ },
1612+ {
1613+ "crate_types": [
1614+ "bin"
1615+ ],
1616+ "doc": true,
1617+ "doctest": false,
1618+ "test": true,
1619+ "edition": "2018",
1620+ "kind": [
1621+ "bin"
1622+ ],
1623+ "name": "b",
1624+ "src_path": "[..]src/bin/b.rs",
1625+ "test": true
1626+ }
1627+ ],
1628+ "version": "0.1.0"
1629+ }
1630+ ],
1631+ "resolve": {
1632+ "nodes": [
1633+ {
1634+ "dependencies": [],
1635+ "deps": [],
1636+ "features": [],
1637+ "id": "foo 0.1.0 (path+file:[..])"
1638+ }
1639+ ],
1640+ "root": "foo 0.1.0 (path+file:[..])"
1641+ },
1642+ "target_directory": "[..]",
1643+ "version": 1,
1644+ "workspace_members": [
1645+ "foo 0.1.0 (path+file:[..])"
1646+ ],
1647+ "workspace_root": "[..]",
1648+ "metadata": null
1649+ }
1650+ "# ,
1651+ )
1652+ . run ( ) ;
1653+ }
1654+
15351655#[ cargo_test]
15361656fn target_edition_2018 ( ) {
15371657 let p = project ( )
You can’t perform that action at this time.
0 commit comments