Skip to content

Commit 13d5327

Browse files
committed
Rename @hastext to @hasraw (same for matches)
I think `@hasraw` is slightly clearer than `@hastext` since it is actually matching against the raw HTML, not the text nodes.
1 parent 37eed1d commit 13d5327

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+175
-175
lines changed

src/etc/htmldocck.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@
4141
`PATH` is relative to the output directory. It can be given as `-`
4242
which repeats the most recently used `PATH`.
4343
44-
* `@hastext PATH PATTERN` and `@matchestext PATH PATTERN` checks
44+
* `@hasraw PATH PATTERN` and `@matchesraw PATH PATTERN` checks
4545
for the occurrence of the given pattern `PATTERN` in the specified file.
4646
Only one occurrence of the pattern is enough.
4747
48-
For `@hastext`, `PATTERN` is a whitespace-normalized (every consecutive
48+
For `@hasraw`, `PATTERN` is a whitespace-normalized (every consecutive
4949
whitespace being replaced by one single space character) string.
5050
The entire file is also whitespace-normalized including newlines.
5151
52-
For `@matchestext`, `PATTERN` is a Python-supported regular expression.
52+
For `@matchesraw`, `PATTERN` is a Python-supported regular expression.
5353
The file remains intact but the regexp is matched without the `MULTILINE`
5454
and `IGNORECASE` options. You can still use a prefix `(?m)` or `(?i)`
5555
to override them, and `\A` and `\Z` for definitely matching
@@ -542,19 +542,19 @@ def get_nb_matching_elements(cache, c, regexp, stop_at_first):
542542
def check_command(c, cache):
543543
try:
544544
cerr = ""
545-
if c.cmd in ['has', 'hastext', 'matches', 'matchestext']: # string test
545+
if c.cmd in ['has', 'hasraw', 'matches', 'matchesraw']: # string test
546546
regexp = c.cmd.startswith('matches')
547-
if len(c.args) == 1 and not regexp and 'text' not in c.cmd: # @has <path> = file existence
547+
if len(c.args) == 1 and not regexp and 'raw' not in c.cmd: # @has <path> = file existence
548548
try:
549549
cache.get_file(c.args[0])
550550
ret = True
551551
except FailedCheck as err:
552552
cerr = str(err)
553553
ret = False
554-
elif len(c.args) == 2 and 'text' in c.cmd: # @hastext/matchestext <path> <pat> = string test
554+
elif len(c.args) == 2 and 'raw' in c.cmd: # @hasraw/matchesraw <path> <pat> = string test
555555
cerr = "`PATTERN` did not match"
556556
ret = check_string(cache.get_file(c.args[0]), c.args[1], regexp)
557-
elif len(c.args) == 3 and 'text' not in c.cmd: # @has/matches <path> <pat> <match> = XML tree test
557+
elif len(c.args) == 3 and 'raw' not in c.cmd: # @has/matches <path> <pat> <match> = XML tree test
558558
cerr = "`XPATH PATTERN` did not match"
559559
ret = get_nb_matching_elements(cache, c, regexp, True) != 0
560560
else:

src/test/rustdoc/deprecated-impls.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ pub struct Foo0;
55

66
impl Foo0 {
77
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.1: fn_with_doc'
8-
// @hastext - 'fn_with_doc short'
9-
// @hastext - 'fn_with_doc full'
8+
// @hasraw - 'fn_with_doc short'
9+
// @hasraw - 'fn_with_doc full'
1010
/// fn_with_doc short
1111
///
1212
/// fn_with_doc full
@@ -52,8 +52,8 @@ pub struct Foo1;
5252

5353
impl Bar for Foo1 {
5454
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc'
55-
// @hastext - 'fn_empty_with_doc_impl short'
56-
// @hastext - 'fn_empty_with_doc_impl full'
55+
// @hasraw - 'fn_empty_with_doc_impl short'
56+
// @hasraw - 'fn_empty_with_doc_impl full'
5757
/// fn_empty_with_doc_impl short
5858
///
5959
/// fn_empty_with_doc_impl full
@@ -63,8 +63,8 @@ impl Bar for Foo1 {
6363
fn fn_empty_without_doc() {}
6464

6565
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc'
66-
// @hastext - 'fn_def_with_doc_impl short'
67-
// @hastext - 'fn_def_with_doc_impl full'
66+
// @hasraw - 'fn_def_with_doc_impl short'
67+
// @hasraw - 'fn_def_with_doc_impl full'
6868
/// fn_def_with_doc_impl short
6969
///
7070
/// fn_def_with_doc_impl full
@@ -74,7 +74,7 @@ impl Bar for Foo1 {
7474
fn fn_def_without_doc() {}
7575

7676
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc'
77-
// @hastext - 'fn_def_def_with_doc short'
77+
// @hasraw - 'fn_def_def_with_doc short'
7878
// @!has - 'fn_def_def_with_doc full'
7979

8080
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc'
@@ -85,33 +85,33 @@ pub struct Foo2;
8585

8686
impl Bar for Foo2 {
8787
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc'
88-
// @hastext - 'fn_empty_with_doc short'
88+
// @hasraw - 'fn_empty_with_doc short'
8989
// @!has - 'fn_empty_with_doc full'
9090
fn fn_empty_with_doc() {}
9191

9292
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.4: fn_empty_without_doc'
93-
// @hastext - 'fn_empty_without_doc_impl short'
94-
// @hastext - 'fn_empty_without_doc_impl full'
93+
// @hasraw - 'fn_empty_without_doc_impl short'
94+
// @hasraw - 'fn_empty_without_doc_impl full'
9595
/// fn_empty_without_doc_impl short
9696
///
9797
/// fn_empty_without_doc_impl full
9898
fn fn_empty_without_doc() {}
9999

100100
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc'
101-
// @hastext - 'fn_def_with_doc short'
101+
// @hasraw - 'fn_def_with_doc short'
102102
// @!has - 'fn_def_with_doc full'
103103
fn fn_def_with_doc() {}
104104

105105
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc'
106-
// @hastext - 'fn_def_without_doc_impl short'
107-
// @hastext - 'fn_def_without_doc_impl full'
106+
// @hasraw - 'fn_def_without_doc_impl short'
107+
// @hasraw - 'fn_def_without_doc_impl full'
108108
/// fn_def_without_doc_impl short
109109
///
110110
/// fn_def_without_doc_impl full
111111
fn fn_def_without_doc() {}
112112

113113
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc'
114-
// @hastext - 'fn_def_def_with_doc short'
114+
// @hasraw - 'fn_def_def_with_doc short'
115115
// @!has - 'fn_def_def_with_doc full'
116116

117117
// @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc'

src/test/rustdoc/elided-lifetime.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,33 @@ pub struct Ref<'a>(&'a u32);
1111
type ARef<'a> = Ref<'a>;
1212

1313
// @has foo/fn.test1.html
14-
// @matchestext - "Ref</a>&lt;'_&gt;"
14+
// @matchesraw - "Ref</a>&lt;'_&gt;"
1515
pub fn test1(a: &u32) -> Ref {
1616
Ref(a)
1717
}
1818

1919
// @has foo/fn.test2.html
20-
// @matchestext - "Ref</a>&lt;'_&gt;"
20+
// @matchesraw - "Ref</a>&lt;'_&gt;"
2121
pub fn test2(a: &u32) -> Ref<'_> {
2222
Ref(a)
2323
}
2424

2525
// @has foo/fn.test3.html
26-
// @matchestext - "Ref</a>&lt;'_&gt;"
26+
// @matchesraw - "Ref</a>&lt;'_&gt;"
2727
pub fn test3(a: &u32) -> ARef {
2828
Ref(a)
2929
}
3030

3131
// @has foo/fn.test4.html
32-
// @matchestext - "Ref</a>&lt;'_&gt;"
32+
// @matchesraw - "Ref</a>&lt;'_&gt;"
3333
pub fn test4(a: &u32) -> ARef<'_> {
3434
Ref(a)
3535
}
3636

3737
// Ensure external paths in inlined docs also display elided lifetime
3838
// @has foo/bar/fn.test5.html
39-
// @matchestext - "Ref</a>&lt;'_&gt;"
39+
// @matchesraw - "Ref</a>&lt;'_&gt;"
4040
// @has foo/bar/fn.test6.html
41-
// @matchestext - "Ref</a>&lt;'_&gt;"
41+
// @matchesraw - "Ref</a>&lt;'_&gt;"
4242
#[doc(inline)]
4343
pub extern crate bar;

src/test/rustdoc/empty-mod-private.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// compile-flags: --document-private-items
22

33
// @has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo'
4-
// @hastext 'empty_mod_private/sidebar-items.js' 'foo'
4+
// @hasraw 'empty_mod_private/sidebar-items.js' 'foo'
55
// @matches 'empty_mod_private/foo/index.html' '//h1' 'Module empty_mod_private::foo'
66
mod foo {}
77

88
// @has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar'
9-
// @hastext 'empty_mod_private/sidebar-items.js' 'bar'
9+
// @hasraw 'empty_mod_private/sidebar-items.js' 'bar'
1010
// @matches 'empty_mod_private/bar/index.html' '//h1' 'Module empty_mod_private::bar'
1111
mod bar {
1212
// @has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
13-
// @hastext 'empty_mod_private/bar/sidebar-items.js' 'baz'
13+
// @hasraw 'empty_mod_private/bar/sidebar-items.js' 'baz'
1414
// @matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module empty_mod_private::bar::baz'
1515
mod baz {}
1616
}

src/test/rustdoc/empty-mod-public.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// @has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo'
2-
// @hastext 'empty_mod_public/sidebar-items.js' 'foo'
2+
// @hasraw 'empty_mod_public/sidebar-items.js' 'foo'
33
// @matches 'empty_mod_public/foo/index.html' '//h1' 'Module empty_mod_public::foo'
44
pub mod foo {}
55

66
// @has 'empty_mod_public/index.html' '//a[@href="bar/index.html"]' 'bar'
7-
// @hastext 'empty_mod_public/sidebar-items.js' 'bar'
7+
// @hasraw 'empty_mod_public/sidebar-items.js' 'bar'
88
// @matches 'empty_mod_public/bar/index.html' '//h1' 'Module empty_mod_public::bar'
99
pub mod bar {
1010
// @has 'empty_mod_public/bar/index.html' '//a[@href="baz/index.html"]' 'baz'
11-
// @hastext 'empty_mod_public/bar/sidebar-items.js' 'baz'
11+
// @hasraw 'empty_mod_public/bar/sidebar-items.js' 'baz'
1212
// @matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module empty_mod_public::bar::baz'
1313
pub mod baz {}
1414
}

src/test/rustdoc/generic-associated-types/issue-94683.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ pub trait Trait {
88
// Make sure that the elided lifetime shows up
99

1010
// @has foo/type.T.html
11-
// @hastext - "pub type T = "
12-
// @hastext - "&lt;'_&gt;"
11+
// @hasraw - "pub type T = "
12+
// @hasraw - "&lt;'_&gt;"
1313
pub type T = fn(&<() as Trait>::Gat<'_>);

src/test/rustdoc/hide-unstable-trait.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
extern crate unstable_trait;
77

8-
// @hastext foo/struct.Foo.html 'bar'
9-
// @hastext foo/struct.Foo.html 'bar2'
8+
// @hasraw foo/struct.Foo.html 'bar'
9+
// @hasraw foo/struct.Foo.html 'bar2'
1010
#[doc(inline)]
1111
pub use unstable_trait::Foo;

src/test/rustdoc/impl-parts-crosscrate.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ pub struct Bar<T> { t: T }
1212
// full impl string. Instead, just make sure something from each part
1313
// is mentioned.
1414

15-
// @hastext implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar
16-
// @hastext - Send
17-
// @hastext - !AnAutoTrait
18-
// @hastext - Copy
15+
// @hasraw implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar
16+
// @hasraw - Send
17+
// @hasraw - !AnAutoTrait
18+
// @hasraw - Copy
1919
impl<T: Send> !rustdoc_impl_parts_crosscrate::AnAutoTrait for Bar<T>
2020
where T: Copy {}

src/test/rustdoc/impl-trait-alias.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
trait MyTrait {}
44
impl MyTrait for i32 {}
55

6-
// @hastext impl_trait_alias/type.Foo.html 'Foo'
6+
// @hasraw impl_trait_alias/type.Foo.html 'Foo'
77
/// debug type
88
pub type Foo = impl MyTrait;
99

10-
// @hastext impl_trait_alias/fn.foo.html 'foo'
10+
// @hasraw impl_trait_alias/fn.foo.html 'foo'
1111
/// debug function
1212
pub fn foo() -> Foo {
1313
1

src/test/rustdoc/inline_cross/add-docs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ extern crate inner;
44

55

66
// @has add_docs/struct.MyStruct.html
7-
// @hastext add_docs/struct.MyStruct.html "Doc comment from ‘pub use’, Doc comment from definition"
7+
// @hasraw add_docs/struct.MyStruct.html "Doc comment from ‘pub use’, Doc comment from definition"
88
/// Doc comment from 'pub use',
99
pub use inner::MyStruct;

src/test/rustdoc/inline_cross/proc_macro.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ extern crate some_macros;
1212
// @has proc_macro/derive.SomeDerive.html
1313

1414
// @has proc_macro/macro.some_proc_macro.html
15-
// @hastext - 'a proc-macro that swallows its input and does nothing.'
15+
// @hasraw - 'a proc-macro that swallows its input and does nothing.'
1616
pub use some_macros::some_proc_macro;
1717

1818
// @has proc_macro/macro.reexported_macro.html
19-
// @hastext - 'Doc comment from the original crate'
19+
// @hasraw - 'Doc comment from the original crate'
2020
pub use some_macros::reexported_macro;
2121

2222
// @has proc_macro/attr.some_proc_attr.html
23-
// @hastext - 'a proc-macro attribute that passes its item through verbatim.'
23+
// @hasraw - 'a proc-macro attribute that passes its item through verbatim.'
2424
pub use some_macros::some_proc_attr;
2525

2626
// @has proc_macro/derive.SomeDerive.html
27-
// @hastext - 'a derive attribute that adds nothing to its input.'
27+
// @hasraw - 'a derive attribute that adds nothing to its input.'
2828
pub use some_macros::SomeDerive;
2929

3030
// @has proc_macro/attr.first_attr.html
31-
// @hastext - 'Generated doc comment'
31+
// @hasraw - 'Generated doc comment'
3232
pub use some_macros::first_attr;
3333

3434
// @has proc_macro/attr.second_attr.html
35-
// @hastext - 'Generated doc comment'
35+
// @hasraw - 'Generated doc comment'
3636
pub use some_macros::second_attr;

src/test/rustdoc/inline_local/glob-extern-document-private-items.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ mod mod1 {
1212
pub use mod1::*;
1313

1414
// @has foo/index.html
15-
// @hastext - "mod1"
16-
// @hastext - "public_fn"
15+
// @hasraw - "mod1"
16+
// @hasraw - "public_fn"
1717
// @!has - "private_fn"
1818
// @has foo/fn.public_fn.html
1919
// @!has foo/fn.private_fn.html
2020

2121
// @has foo/mod1/index.html
22-
// @hastext - "public_fn"
23-
// @hastext - "private_fn"
22+
// @hasraw - "public_fn"
23+
// @hasraw - "private_fn"
2424
// @has foo/mod1/fn.public_fn.html
2525
// @has foo/mod1/fn.private_fn.html

src/test/rustdoc/inline_local/glob-extern.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub use mod1::*;
1111

1212
// @has foo/index.html
1313
// @!has - "mod1"
14-
// @hastext - "public_fn"
14+
// @hasraw - "public_fn"
1515
// @!has - "private_fn"
1616
// @has foo/fn.public_fn.html
1717
// @!has foo/fn.private_fn.html

src/test/rustdoc/inline_local/glob-private-document-private-items.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ mod mod1 {
1515
pub use mod1::*;
1616

1717
// @has foo/index.html
18-
// @hastext - "mod1"
19-
// @hastext - "Mod1Public"
18+
// @hasraw - "mod1"
19+
// @hasraw - "Mod1Public"
2020
// @!has - "Mod1Private"
2121
// @!has - "mod2"
22-
// @hastext - "Mod2Public"
22+
// @hasraw - "Mod2Public"
2323
// @!has - "Mod2Private"
2424
// @has foo/struct.Mod1Public.html
2525
// @!has foo/struct.Mod1Private.html
2626
// @has foo/struct.Mod2Public.html
2727
// @!has foo/struct.Mod2Private.html
2828

2929
// @has foo/mod1/index.html
30-
// @hastext - "mod2"
31-
// @hastext - "Mod1Public"
32-
// @hastext - "Mod1Private"
30+
// @hasraw - "mod2"
31+
// @hasraw - "Mod1Public"
32+
// @hasraw - "Mod1Private"
3333
// @!has - "Mod2Public"
3434
// @!has - "Mod2Private"
3535
// @has foo/mod1/struct.Mod1Public.html
@@ -38,8 +38,8 @@ pub use mod1::*;
3838
// @!has foo/mod1/struct.Mod2Private.html
3939

4040
// @has foo/mod1/mod2/index.html
41-
// @hastext - "Mod2Public"
42-
// @hastext - "Mod2Private"
41+
// @hasraw - "Mod2Public"
42+
// @hasraw - "Mod2Private"
4343
// @has foo/mod1/mod2/struct.Mod2Public.html
4444
// @has foo/mod1/mod2/struct.Mod2Private.html
4545

src/test/rustdoc/inline_local/glob-private.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ pub use mod1::*;
1414

1515
// @has foo/index.html
1616
// @!has - "mod1"
17-
// @hastext - "Mod1Public"
17+
// @hasraw - "Mod1Public"
1818
// @!has - "Mod1Private"
1919
// @!has - "mod2"
20-
// @hastext - "Mod2Public"
20+
// @hasraw - "Mod2Public"
2121
// @!has - "Mod2Private"
2222
// @has foo/struct.Mod1Public.html
2323
// @!has foo/struct.Mod1Private.html

src/test/rustdoc/inline_local/please_inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod a {
1212

1313
// @has please_inline/b/index.html
1414
pub mod b {
15-
// @hastext - 'pub use foo::'
15+
// @hasraw - 'pub use foo::'
1616
// @!has please_inline/b/struct.Foo.html
1717
#[feature(inline)]
1818
pub use foo::Foo;

src/test/rustdoc/intra-doc/extern-type.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ impl G<usize> for ExternType {
2525
}
2626

2727
// @has 'extern_type/foreigntype.ExternType.html'
28-
// @hastext 'extern_type/fn.links_to_extern_type.html' \
28+
// @hasraw 'extern_type/fn.links_to_extern_type.html' \
2929
// 'href="foreigntype.ExternType.html#method.f"'
30-
// @hastext 'extern_type/fn.links_to_extern_type.html' \
30+
// @hasraw 'extern_type/fn.links_to_extern_type.html' \
3131
// 'href="foreigntype.ExternType.html#method.test"'
32-
// @hastext 'extern_type/fn.links_to_extern_type.html' \
32+
// @hasraw 'extern_type/fn.links_to_extern_type.html' \
3333
// 'href="foreigntype.ExternType.html#method.g"'
3434
/// See also [ExternType::f]
3535
/// See also [ExternType::test]

0 commit comments

Comments
 (0)