about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSunshine <sunshine_40@qq.com>2024-06-07 11:42:17 +0800
committerSunshine <sunshine_40@qq.com>2024-06-07 11:55:52 +0800
commitceaa42b81785e58b2ddbd1826d4f0d97143f13ca (patch)
treece36fa4873ccb6a28a2df7baf183156d2f96cf62
parent5a23111b77924ef5f1b1472eae0b6fe6d76547ac (diff)
downloadrust-ceaa42b81785e58b2ddbd1826d4f0d97143f13ca.tar.gz
rust-ceaa42b81785e58b2ddbd1826d4f0d97143f13ca.zip
Update tests
-rw-r--r--src/librustdoc/html/static/js/search.js5
-rw-r--r--tests/rustdoc-js-std/parser-errors.js23
-rw-r--r--tests/rustdoc-js/non-english-identifier.js2
3 files changed, 20 insertions, 10 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index e5a1f9d1be0..8ac4b53673f 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -671,9 +671,10 @@ function initSearch(rawSearchIndex) {
             ) {
                 break;
             } else if (parserState.pos > 0) {
-                throw ["Unexpected ", c, " after ", parserState.userQuery[parserState.pos - 1]];
+                throw ["Unexpected ", c, " after ", parserState.userQuery[parserState.pos - 1],
+                    " (not a valid identifier)"];
             } else {
-                throw ["Unexpected ", c];
+                throw ["Unexpected ", c, " (not a valid identifier)"];
             }
             parserState.pos += 1;
             afterIdent = consumeIdent(parserState);
diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js
index ffd169812b6..c4d7c2b0b85 100644
--- a/tests/rustdoc-js-std/parser-errors.js
+++ b/tests/rustdoc-js-std/parser-errors.js
@@ -24,7 +24,7 @@ const PARSED = [
         original: "-> *",
         returned: [],
         userQuery: "-> *",
-        error: "Unexpected `*` after ` `",
+        error: "Unexpected `*` after ` ` (not a valid identifier)",
     },
     {
         query: 'a<"P">',
@@ -204,16 +204,25 @@ const PARSED = [
         original: "_:",
         returned: [],
         userQuery: "_:",
-        error: "Unexpected `:` (expected path after type filter `_:`)",
+        error: "Unexpected `_` (not a valid identifier)",
     },
     {
-        query: "_:a",
+        query: "ab:",
         elems: [],
         foundElems: 0,
-        original: "_:a",
+        original: "ab:",
         returned: [],
-        userQuery: "_:a",
-        error: "Unknown type filter `_`",
+        userQuery: "ab:",
+        error: "Unexpected `:` (expected path after type filter `ab:`)",
+    },
+    {
+        query: "a:b",
+        elems: [],
+        foundElems: 0,
+        original: "a:b",
+        returned: [],
+        userQuery: "a:b",
+        error: "Unknown type filter `a`",
     },
     {
         query: "a-bb",
@@ -240,7 +249,7 @@ const PARSED = [
         original: "ab'",
         returned: [],
         userQuery: "ab'",
-        error: "Unexpected `'` after `b`",
+        error: "Unexpected `'` after `b` (not a valid identifier)",
     },
     {
         query: "a->",
diff --git a/tests/rustdoc-js/non-english-identifier.js b/tests/rustdoc-js/non-english-identifier.js
index 84209aa04c0..1765a69152a 100644
--- a/tests/rustdoc-js/non-english-identifier.js
+++ b/tests/rustdoc-js/non-english-identifier.js
@@ -105,7 +105,7 @@ const PARSED = [
         original: "非法符号——",
         returned: [],
         userQuery: "非法符号——",
-        error: "Unexpected `—` after `号`",
+        error: "Unexpected `—` after `号` (not a valid identifier)",
     }
 ]
 const EXPECTED = [