summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-json/structs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /tests/rustdoc-json/structs
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-json/structs')
-rw-r--r--tests/rustdoc-json/structs/field_order.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/rustdoc-json/structs/field_order.rs b/tests/rustdoc-json/structs/field_order.rs
new file mode 100644
index 000000000..a8c18323d
--- /dev/null
+++ b/tests/rustdoc-json/structs/field_order.rs
@@ -0,0 +1,38 @@
+// Check that the order of fields is preserved.
+
+pub struct Foo {
+ // Important: random prefixes are used here to ensure that
+ // sorting fields by name would cause this test to fail.
+ pub ews_0: i32,
+ pub dik_1: i32,
+ pub hsk_2: i32,
+ pub djt_3: i32,
+ pub jnr_4: i32,
+ pub dfs_5: i32,
+ pub bja_6: i32,
+ pub lyc_7: i32,
+ pub yqd_8: i32,
+ pub vll_9: i32,
+}
+
+// @set 0 = '$.index[*][?(@.name == "ews_0")].id'
+// @set 1 = '$.index[*][?(@.name == "dik_1")].id'
+// @set 2 = '$.index[*][?(@.name == "hsk_2")].id'
+// @set 3 = '$.index[*][?(@.name == "djt_3")].id'
+// @set 4 = '$.index[*][?(@.name == "jnr_4")].id'
+// @set 5 = '$.index[*][?(@.name == "dfs_5")].id'
+// @set 6 = '$.index[*][?(@.name == "bja_6")].id'
+// @set 7 = '$.index[*][?(@.name == "lyc_7")].id'
+// @set 8 = '$.index[*][?(@.name == "yqd_8")].id'
+// @set 9 = '$.index[*][?(@.name == "vll_9")].id'
+
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[0]' $0
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[1]' $1
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[2]' $2
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[3]' $3
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[4]' $4
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[5]' $5
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[6]' $6
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[7]' $7
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[8]' $8
+// @is '$.index[*][?(@.name == "Foo")].inner.struct.kind.plain.fields[9]' $9