@@ -47,7 +47,8 @@ fn cargo_metadata_simple() {
4747 ],
4848 "features": {},
4949 "manifest_path": "[..]Cargo.toml",
50- "metadata": null
50+ "metadata": null,
51+ "publish": null
5152 }
5253 ],
5354 "workspace_members": ["foo 0.5.0 (path+file:[..]foo)"],
@@ -138,7 +139,8 @@ crate-type = ["lib", "staticlib"]
138139 ],
139140 "features": {},
140141 "manifest_path": "[..]Cargo.toml",
141- "metadata": null
142+ "metadata": null,
143+ "publish": null
142144 }
143145 ],
144146 "workspace_members": ["foo 0.5.0 (path+file:[..]foo)"],
@@ -223,7 +225,8 @@ optional_feat = []
223225 "optional_feat": []
224226 },
225227 "manifest_path": "[..]Cargo.toml",
226- "metadata": null
228+ "metadata": null,
229+ "publish": null
227230 }
228231 ],
229232 "workspace_members": ["foo 0.5.0 (path+file:[..]foo)"],
@@ -296,6 +299,7 @@ fn cargo_metadata_with_deps_and_version() {
296299 "links": null,
297300 "manifest_path": "[..]Cargo.toml",
298301 "metadata": null,
302+ "publish": null,
299303 "name": "baz",
300304 "readme": null,
301305 "repository": null,
@@ -355,6 +359,7 @@ fn cargo_metadata_with_deps_and_version() {
355359 "links": null,
356360 "manifest_path": "[..]Cargo.toml",
357361 "metadata": null,
362+ "publish": null,
358363 "name": "foo",
359364 "readme": null,
360365 "repository": null,
@@ -389,6 +394,7 @@ fn cargo_metadata_with_deps_and_version() {
389394 "links": null,
390395 "manifest_path": "[..]Cargo.toml",
391396 "metadata": null,
397+ "publish": null,
392398 "name": "foobar",
393399 "readme": null,
394400 "repository": null,
@@ -436,6 +442,7 @@ fn cargo_metadata_with_deps_and_version() {
436442 "links": null,
437443 "manifest_path": "[..]Cargo.toml",
438444 "metadata": null,
445+ "publish": null,
439446 "name": "bar",
440447 "readme": null,
441448 "repository": null,
@@ -575,7 +582,8 @@ name = "ex"
575582 ],
576583 "features": {},
577584 "manifest_path": "[..]Cargo.toml",
578- "metadata": null
585+ "metadata": null,
586+ "publish": null
579587 }
580588 ],
581589 "workspace_members": [
@@ -660,7 +668,8 @@ crate-type = ["rlib", "dylib"]
660668 ],
661669 "features": {},
662670 "manifest_path": "[..]Cargo.toml",
663- "metadata": null
671+ "metadata": null,
672+ "publish": null
664673 }
665674 ],
666675 "workspace_members": [
@@ -736,7 +745,8 @@ fn workspace_metadata() {
736745 ],
737746 "features": {},
738747 "manifest_path": "[..]bar/Cargo.toml",
739- "metadata": null
748+ "metadata": null,
749+ "publish": null
740750 },
741751 {
742752 "authors": [
@@ -768,7 +778,8 @@ fn workspace_metadata() {
768778 ],
769779 "features": {},
770780 "manifest_path": "[..]baz/Cargo.toml",
771- "metadata": null
781+ "metadata": null,
782+ "publish": null
772783 }
773784 ],
774785 "workspace_members": ["baz 0.5.0 (path+file:[..]baz)", "bar 0.5.0 (path+file:[..]bar)"],
@@ -848,7 +859,8 @@ fn workspace_metadata_no_deps() {
848859 ],
849860 "features": {},
850861 "manifest_path": "[..]bar/Cargo.toml",
851- "metadata": null
862+ "metadata": null,
863+ "publish": null
852864 },
853865 {
854866 "authors": [
@@ -880,7 +892,8 @@ fn workspace_metadata_no_deps() {
880892 ],
881893 "features": {},
882894 "manifest_path": "[..]baz/Cargo.toml",
883- "metadata": null
895+ "metadata": null,
896+ "publish": null
884897 }
885898 ],
886899 "workspace_members": ["baz 0.5.0 (path+file:[..]baz)", "bar 0.5.0 (path+file:[..]bar)"],
@@ -938,6 +951,7 @@ const MANIFEST_OUTPUT: &str = r#"
938951 "features":{},
939952 "manifest_path":"[..]Cargo.toml",
940953 "metadata": null,
954+ "publish": null,
941955 "readme": null,
942956 "repository": null
943957 }],
@@ -1121,7 +1135,75 @@ fn package_metadata() {
11211135 "bar": {
11221136 "baz": "quux"
11231137 }
1124- }
1138+ },
1139+ "publish": null
1140+ }
1141+ ],
1142+ "workspace_members": ["foo[..]"],
1143+ "resolve": null,
1144+ "target_directory": "[..]foo/target",
1145+ "version": 1,
1146+ "workspace_root": "[..]/foo"
1147+ }"# ,
1148+ )
1149+ . run ( ) ;
1150+ }
1151+
1152+ #[ cargo_test]
1153+ fn package_publish ( ) {
1154+ let p = project ( )
1155+ . file (
1156+ "Cargo.toml" ,
1157+ r#"
1158+ [package]
1159+ name = "foo"
1160+ version = "0.1.0"
1161+ authors = ["wycats@example.com"]
1162+ categories = ["database"]
1163+ keywords = ["database"]
1164+ readme = "README.md"
1165+ repository = "https://github.com/rust-lang/cargo"
1166+ publish = ["my-registry"]
1167+ "# ,
1168+ )
1169+ . file ( "src/lib.rs" , "" )
1170+ . build ( ) ;
1171+
1172+ p. cargo ( "metadata --no-deps" )
1173+ . with_json (
1174+ r#"
1175+ {
1176+ "packages": [
1177+ {
1178+ "authors": ["wycats@example.com"],
1179+ "categories": ["database"],
1180+ "name": "foo",
1181+ "readme": "README.md",
1182+ "repository": "https://github.com/rust-lang/cargo",
1183+ "version": "0.1.0",
1184+ "id": "foo[..]",
1185+ "keywords": ["database"],
1186+ "source": null,
1187+ "dependencies": [],
1188+ "edition": "2015",
1189+ "license": null,
1190+ "license_file": null,
1191+ "links": null,
1192+ "description": null,
1193+ "targets": [
1194+ {
1195+ "kind": [ "lib" ],
1196+ "crate_types": [ "lib" ],
1197+ "doctest": true,
1198+ "edition": "2015",
1199+ "name": "foo",
1200+ "src_path": "[..]foo/src/lib.rs"
1201+ }
1202+ ],
1203+ "features": {},
1204+ "manifest_path": "[..]foo/Cargo.toml",
1205+ "metadata": null,
1206+ "publish": ["my-registry"]
11251207 }
11261208 ],
11271209 "workspace_members": ["foo[..]"],
@@ -1175,6 +1257,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
11751257 "links": null,
11761258 "manifest_path": "[..]Cargo.toml",
11771259 "metadata": null,
1260+ "publish": null,
11781261 "name": "bar",
11791262 "readme": null,
11801263 "repository": null,
@@ -1255,6 +1338,7 @@ fn package_edition_2018() {
12551338 "links": null,
12561339 "manifest_path": "[..]Cargo.toml",
12571340 "metadata": null,
1341+ "publish": null,
12581342 "name": "foo",
12591343 "readme": null,
12601344 "repository": null,
@@ -1339,6 +1423,7 @@ fn target_edition_2018() {
13391423 "links": null,
13401424 "manifest_path": "[..]Cargo.toml",
13411425 "metadata": null,
1426+ "publish": null,
13421427 "name": "foo",
13431428 "readme": null,
13441429 "repository": null,
@@ -1461,6 +1546,7 @@ fn rename_dependency() {
14611546 "links": null,
14621547 "manifest_path": "[..]",
14631548 "metadata": null,
1549+ "publish": null,
14641550 "name": "foo",
14651551 "readme": null,
14661552 "repository": null,
@@ -1495,6 +1581,7 @@ fn rename_dependency() {
14951581 "links": null,
14961582 "manifest_path": "[..]",
14971583 "metadata": null,
1584+ "publish": null,
14981585 "name": "bar",
14991586 "readme": null,
15001587 "repository": null,
@@ -1529,6 +1616,7 @@ fn rename_dependency() {
15291616 "links": null,
15301617 "manifest_path": "[..]",
15311618 "metadata": null,
1619+ "publish": null,
15321620 "name": "bar",
15331621 "readme": null,
15341622 "repository": null,
@@ -1631,6 +1719,7 @@ fn metadata_links() {
16311719 "links": "a",
16321720 "manifest_path": "[..]/foo/Cargo.toml",
16331721 "metadata": null,
1722+ "publish": null,
16341723 "name": "foo",
16351724 "readme": null,
16361725 "repository": null,
0 commit comments