Skip to content

Commit 46e7e83

Browse files
committed
Auto merge of #14319 - epage:doc-json, r=weihanglo
Partial revert of 3085b54 This is to quickly resolve a test failure from #14318
2 parents a7c4206 + 3ae4045 commit 46e7e83

File tree

1 file changed

+80
-104
lines changed

1 file changed

+80
-104
lines changed

tests/testsuite/doc.rs

Lines changed: 80 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,29 +1879,24 @@ fn doc_message_format() {
18791879

18801880
p.cargo("doc --message-format=json")
18811881
.with_status(101)
1882-
.with_stdout_data(
1883-
str![[r##"
1884-
[
1885-
{
1886-
"manifest_path": "[ROOT]/foo/Cargo.toml",
1887-
"message": {
1888-
"$message_type": "diagnostic",
1889-
"children": "{...}",
1890-
"code": "{...}",
1891-
"level": "error",
1892-
"message": "{...}",
1893-
"rendered": "{...}",
1894-
"spans": "{...}"
1895-
},
1896-
"package_id": "path+[ROOTURL]/foo#0.0.1",
1897-
"reason": "compiler-message",
1898-
"target": "{...}"
1899-
},
1900-
"{...}"
1901-
]
1902-
"##]]
1903-
.is_json()
1904-
.against_jsonlines(),
1882+
.with_json_contains_unordered(
1883+
r#"
1884+
{
1885+
"message": {
1886+
"$message_type": "diagnostic",
1887+
"children": "{...}",
1888+
"code": "{...}",
1889+
"level": "error",
1890+
"message": "{...}",
1891+
"rendered": "{...}",
1892+
"spans": "{...}"
1893+
},
1894+
"package_id": "path+file:///[..]/foo#0.0.1",
1895+
"manifest_path": "[..]",
1896+
"reason": "compiler-message",
1897+
"target": "{...}"
1898+
}
1899+
"#,
19051900
)
19061901
.run();
19071902
}
@@ -1916,95 +1911,76 @@ fn doc_json_artifacts() {
19161911
.build();
19171912

19181913
p.cargo("doc --message-format=json")
1919-
.with_stdout_data(
1920-
str![[r#"
1921-
[
1922-
{
1923-
"executable": null,
1924-
"features": [],
1925-
"filenames": [
1926-
"[ROOT]/foo/target/debug/deps/libfoo-[HASH].rmeta"
1927-
],
1928-
"fresh": false,
1914+
.with_json_contains_unordered(
1915+
r#"
1916+
{
1917+
"reason": "compiler-artifact",
1918+
"package_id": "path+file:///[..]/foo#0.0.1",
19291919
"manifest_path": "[ROOT]/foo/Cargo.toml",
1930-
"package_id": "path+[ROOTURL]/foo#0.0.1",
1920+
"target":
1921+
{
1922+
"kind": ["lib"],
1923+
"crate_types": ["lib"],
1924+
"name": "foo",
1925+
"src_path": "[ROOT]/foo/src/lib.rs",
1926+
"edition": "2015",
1927+
"doc": true,
1928+
"doctest": true,
1929+
"test": true
1930+
},
19311931
"profile": "{...}",
1932-
"reason": "compiler-artifact",
1933-
"target": {
1934-
"crate_types": [
1935-
"lib"
1936-
],
1937-
"doc": true,
1938-
"doctest": true,
1939-
"edition": "2015",
1940-
"kind": [
1941-
"lib"
1942-
],
1943-
"name": "foo",
1944-
"src_path": "[ROOT]/foo/src/lib.rs",
1945-
"test": true
1946-
}
1947-
},
1948-
{
1949-
"executable": null,
19501932
"features": [],
1951-
"filenames": [
1952-
"[ROOT]/foo/target/doc/foo/index.html"
1953-
],
1954-
"fresh": false,
1933+
"filenames": ["[ROOT]/foo/target/debug/deps/libfoo-[..].rmeta"],
1934+
"executable": null,
1935+
"fresh": false
1936+
}
1937+
1938+
{
1939+
"reason": "compiler-artifact",
1940+
"package_id": "path+file:///[..]/foo#0.0.1",
19551941
"manifest_path": "[ROOT]/foo/Cargo.toml",
1956-
"package_id": "path+[ROOTURL]/foo#0.0.1",
1942+
"target":
1943+
{
1944+
"kind": ["lib"],
1945+
"crate_types": ["lib"],
1946+
"name": "foo",
1947+
"src_path": "[ROOT]/foo/src/lib.rs",
1948+
"edition": "2015",
1949+
"doc": true,
1950+
"doctest": true,
1951+
"test": true
1952+
},
19571953
"profile": "{...}",
1958-
"reason": "compiler-artifact",
1959-
"target": {
1960-
"crate_types": [
1961-
"lib"
1962-
],
1963-
"doc": true,
1964-
"doctest": true,
1965-
"edition": "2015",
1966-
"kind": [
1967-
"lib"
1968-
],
1969-
"name": "foo",
1970-
"src_path": "[ROOT]/foo/src/lib.rs",
1971-
"test": true
1972-
}
1973-
},
1974-
{
1975-
"executable": null,
19761954
"features": [],
1977-
"filenames": [
1978-
"[ROOT]/foo/target/doc/somebin/index.html"
1979-
],
1980-
"fresh": false,
1955+
"filenames": ["[ROOT]/foo/target/doc/foo/index.html"],
1956+
"executable": null,
1957+
"fresh": false
1958+
}
1959+
1960+
{
1961+
"reason": "compiler-artifact",
1962+
"package_id": "path+file:///[..]/foo#0.0.1",
19811963
"manifest_path": "[ROOT]/foo/Cargo.toml",
1982-
"package_id": "path+[ROOTURL]/foo#0.0.1",
1964+
"target":
1965+
{
1966+
"kind": ["bin"],
1967+
"crate_types": ["bin"],
1968+
"name": "somebin",
1969+
"src_path": "[ROOT]/foo/src/bin/somebin.rs",
1970+
"edition": "2015",
1971+
"doc": true,
1972+
"doctest": false,
1973+
"test": true
1974+
},
19831975
"profile": "{...}",
1984-
"reason": "compiler-artifact",
1985-
"target": {
1986-
"crate_types": [
1987-
"bin"
1988-
],
1989-
"doc": true,
1990-
"doctest": false,
1991-
"edition": "2015",
1992-
"kind": [
1993-
"bin"
1994-
],
1995-
"name": "somebin",
1996-
"src_path": "[ROOT]/foo/src/bin/somebin.rs",
1997-
"test": true
1998-
}
1999-
},
2000-
{
2001-
"reason": "build-finished",
2002-
"success": true
2003-
}
2004-
]
2005-
"#]]
2006-
.is_json()
2007-
.against_jsonlines(),
1976+
"features": [],
1977+
"filenames": ["[ROOT]/foo/target/doc/somebin/index.html"],
1978+
"executable": null,
1979+
"fresh": false
1980+
}
1981+
1982+
{"reason":"build-finished","success":true}
1983+
"#,
20081984
)
20091985
.run();
20101986
}

0 commit comments

Comments
 (0)