diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-11-13 16:56:40 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-11-13 16:56:40 +0100 |
| commit | 7a8257dc471762343457c2963b1ccf1a868d06e8 (patch) | |
| tree | 4106a98dac514d8dda45875896ab6e84ccf24ee7 | |
| parent | d9aac8cfcefcd4063fc39ff19e9ace373471bbbc (diff) | |
| download | rust-7a8257dc471762343457c2963b1ccf1a868d06e8.tar.gz rust-7a8257dc471762343457c2963b1ccf1a868d06e8.zip | |
Add regression test for #131901
| -rw-r--r-- | tests/rustdoc/footnote-ids.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/rustdoc/footnote-ids.rs b/tests/rustdoc/footnote-ids.rs new file mode 100644 index 00000000000..d3a8435bb47 --- /dev/null +++ b/tests/rustdoc/footnote-ids.rs @@ -0,0 +1,41 @@ +// This test ensures that footnotes ID are not duplicated across an item page. +// This is a regression test for <https://github.com/rust-lang/rust/issues/131901>. + +#![crate_name = "foo"] + +//@ has 'foo/struct.Foo.html' + +pub struct Foo; + +impl Foo { + //@ has - '//a[@href="#fn1"]' '1' + //@ has - '//li[@id="fn1"]' 'Hiya' + //@ has - '//a[@href="#fn2"]' '2' + //@ has - '//li[@id="fn2"]' 'Tiya' + /// Link 1 [^1] + /// Link 1.1 [^2] + /// + /// [^1]: Hiya + /// [^2]: Tiya + pub fn l1(){} + + //@ has - '//a[@href="#fn3"]' '1' + //@ has - '//li[@id="fn3"]' 'Yiya' + //@ has - '//a[@href="#fn4"]' '2' + //@ has - '//li[@id="fn4"]' 'Biya' + /// Link 2 [^1] + /// Link 3 [^2] + /// + /// [^1]: Yiya + /// [^2]: Biya + pub fn l2() {} +} + +impl Foo { + //@ has - '//a[@href="#fn5"]' '1' + //@ has - '//li[@id="fn5"]' 'Ciya' + /// Link 3 [^1] + /// + /// [^1]: Ciya + pub fn l3(){} +} |
