Skip to content

Commit a9a0746

Browse files
committed
Auto merge of #13703 - epage:toml, r=arlosi
test(metadata): Show behavior with TOML-specific types ### What does this PR try to resolve? The goal is to know if/when these change so we can have a conversation about what to do. ### How should we test and review this PR? ### Additional information
2 parents 6bb0ba1 + b930f7a commit a9a0746

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

tests/testsuite/metadata.rs

+106
Original file line numberDiff line numberDiff line change
@@ -4546,3 +4546,109 @@ fn versionless_packages() {
45464546
)
45474547
.run();
45484548
}
4549+
4550+
/// Record how TOML-specific types are deserialized by `toml` so we can make sure we know if these change and
4551+
/// can have a conversation about what should be done.
4552+
#[cargo_test]
4553+
fn cargo_metadata_toml_types() {
4554+
let p = project()
4555+
.file("src/lib.rs", "")
4556+
.file(
4557+
"Cargo.toml",
4558+
"
4559+
[package]
4560+
name = 'foo'
4561+
edition = '2015'
4562+
4563+
[package.metadata]
4564+
offset-datetime = 1979-05-27T07:32:00Z
4565+
local-datetime = 1979-05-27T07:32:00
4566+
local-date = 1979-05-27
4567+
local-time = 1979-05-27
4568+
",
4569+
)
4570+
.build();
4571+
4572+
p.cargo("metadata")
4573+
.with_json(
4574+
r#"
4575+
{
4576+
"packages": [
4577+
{
4578+
"authors": [],
4579+
"categories": [],
4580+
"default_run": null,
4581+
"name": "foo",
4582+
"version": "0.0.0",
4583+
"id": "[..]foo#0.0.0",
4584+
"keywords": [],
4585+
"source": null,
4586+
"dependencies": [],
4587+
"edition": "2015",
4588+
"license": null,
4589+
"license_file": null,
4590+
"links": null,
4591+
"description": null,
4592+
"readme": null,
4593+
"repository": null,
4594+
"rust_version": null,
4595+
"homepage": null,
4596+
"documentation": null,
4597+
"homepage": null,
4598+
"documentation": null,
4599+
"targets": [
4600+
{
4601+
"kind": [
4602+
"lib"
4603+
],
4604+
"crate_types": [
4605+
"lib"
4606+
],
4607+
"doc": true,
4608+
"doctest": true,
4609+
"test": true,
4610+
"edition": "2015",
4611+
"name": "foo",
4612+
"src_path": "[..]/foo/src/lib.rs"
4613+
}
4614+
],
4615+
"features": {},
4616+
"manifest_path": "[..]Cargo.toml",
4617+
"metadata": {
4618+
"local-date": {
4619+
"$__toml_private_datetime": "1979-05-27"
4620+
},
4621+
"local-datetime": {
4622+
"$__toml_private_datetime": "1979-05-27T07:32:00"
4623+
},
4624+
"local-time": {
4625+
"$__toml_private_datetime": "1979-05-27"
4626+
},
4627+
"offset-datetime": {
4628+
"$__toml_private_datetime": "1979-05-27T07:32:00Z"
4629+
}
4630+
},
4631+
"publish": []
4632+
}
4633+
],
4634+
"workspace_members": ["path+file:[..]foo#0.0.0"],
4635+
"workspace_default_members": ["path+file:[..]foo#0.0.0"],
4636+
"resolve": {
4637+
"nodes": [
4638+
{
4639+
"dependencies": [],
4640+
"deps": [],
4641+
"features": [],
4642+
"id": "path+file:[..]foo#0.0.0"
4643+
}
4644+
],
4645+
"root": "path+file:[..]foo#0.0.0"
4646+
},
4647+
"target_directory": "[..]foo/target",
4648+
"version": 1,
4649+
"workspace_root": "[..]/foo",
4650+
"metadata": null
4651+
}"#,
4652+
)
4653+
.run();
4654+
}

0 commit comments

Comments
 (0)