about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-04-16 15:28:28 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-04-18 20:32:40 +0200
commitba9a008d90ad7b9c11379a00766f9e4ebbcdc126 (patch)
tree123f20138051987165ada3d720e2e13bf3476c3d
parent59477a8ab21480a5c3da0313ef5a235091d8cbee (diff)
downloadrust-ba9a008d90ad7b9c11379a00766f9e4ebbcdc126.tar.gz
rust-ba9a008d90ad7b9c11379a00766f9e4ebbcdc126.zip
Add regression test for span 1-indexed check
-rw-r--r--tests/rustdoc-json/impls/auto.rs4
-rw-r--r--tests/rustdoc-json/span.rs4
2 files changed, 6 insertions, 2 deletions
diff --git a/tests/rustdoc-json/impls/auto.rs b/tests/rustdoc-json/impls/auto.rs
index f94f7338480..ce47d1be690 100644
--- a/tests/rustdoc-json/impls/auto.rs
+++ b/tests/rustdoc-json/impls/auto.rs
@@ -15,8 +15,8 @@ impl Foo {
 }
 
 // Testing spans, so all tests below code
-//@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 0]"
-//@ is "$.index[?(@.docs=='has span')].span.end" "[15, 1]"
+//@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 1]"
+//@ is "$.index[?(@.docs=='has span')].span.end" "[15, 2]"
 // FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
 // is "$.index[?(@.inner.impl.is_synthetic==true)].span" null
 pub struct Foo;
diff --git a/tests/rustdoc-json/span.rs b/tests/rustdoc-json/span.rs
new file mode 100644
index 00000000000..c96879d0e68
--- /dev/null
+++ b/tests/rustdoc-json/span.rs
@@ -0,0 +1,4 @@
+pub mod bar {}
+// This test ensures that spans are 1-indexed.
+//@ is "$.index[?(@.name=='span')].span.begin" "[1, 1]"
+//@ is "$.index[?(@.name=='bar')].span.begin" "[1, 1]"