Skip to content

Commit

Permalink
Auto merge of #13703 - epage:toml, r=arlosi
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Apr 4, 2024
2 parents 6bb0ba1 + b930f7a commit a9a0746
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions tests/testsuite/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4546,3 +4546,109 @@ fn versionless_packages() {
)
.run();
}

/// Record how TOML-specific types are deserialized by `toml` so we can make sure we know if these change and
/// can have a conversation about what should be done.
#[cargo_test]
fn cargo_metadata_toml_types() {
let p = project()
.file("src/lib.rs", "")
.file(
"Cargo.toml",
"
[package]
name = 'foo'
edition = '2015'
[package.metadata]
offset-datetime = 1979-05-27T07:32:00Z
local-datetime = 1979-05-27T07:32:00
local-date = 1979-05-27
local-time = 1979-05-27
",
)
.build();

p.cargo("metadata")
.with_json(
r#"
{
"packages": [
{
"authors": [],
"categories": [],
"default_run": null,
"name": "foo",
"version": "0.0.0",
"id": "[..]foo#0.0.0",
"keywords": [],
"source": null,
"dependencies": [],
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"readme": null,
"repository": null,
"rust_version": null,
"homepage": null,
"documentation": null,
"homepage": null,
"documentation": null,
"targets": [
{
"kind": [
"lib"
],
"crate_types": [
"lib"
],
"doc": true,
"doctest": true,
"test": true,
"edition": "2015",
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
}
],
"features": {},
"manifest_path": "[..]Cargo.toml",
"metadata": {
"local-date": {
"$__toml_private_datetime": "1979-05-27"
},
"local-datetime": {
"$__toml_private_datetime": "1979-05-27T07:32:00"
},
"local-time": {
"$__toml_private_datetime": "1979-05-27"
},
"offset-datetime": {
"$__toml_private_datetime": "1979-05-27T07:32:00Z"
}
},
"publish": []
}
],
"workspace_members": ["path+file:[..]foo#0.0.0"],
"workspace_default_members": ["path+file:[..]foo#0.0.0"],
"resolve": {
"nodes": [
{
"dependencies": [],
"deps": [],
"features": [],
"id": "path+file:[..]foo#0.0.0"
}
],
"root": "path+file:[..]foo#0.0.0"
},
"target_directory": "[..]foo/target",
"version": 1,
"workspace_root": "[..]/foo",
"metadata": null
}"#,
)
.run();
}

0 comments on commit a9a0746

Please sign in to comment.