|
| 1 | +/*** |
| 2 | +
|
| 3 | +// See https://github.com/rust-lang/rust-dbg-ext/blob/main/test-framework/dbt/README.md |
| 4 | +// for more information on how these test scripts work. |
| 5 | +
|
| 6 | +#if @cdb |
| 7 | + // Start running the program |
| 8 | + g |
| 9 | +
|
| 10 | + // The following line checks that we actually hit the breakpoint. |
| 11 | + #check Breakpoint 0 hit |
| 12 | +
|
| 13 | + // Ensure the Natvis file for the regex crate is loaded. |
| 14 | + .nvlist |
| 15 | + #check natvis.exe (embedded NatVis "@{ .* }@natvis-0.natvis") |
| 16 | +
|
| 17 | + // Check the Natvis visualization for re::unicode::Regex |
| 18 | + dv |
| 19 | + dx re |
| 20 | + #check re : { text="hits="[0-9]+"" } [Type: regex::re_unicode::Regex] |
| 21 | + #check [<Raw View>] [Type: regex::re_unicode::Regex] |
| 22 | + #check [Reference count] : 0x2 [Type: core::sync::atomic::AtomicUsize] |
| 23 | + #check [Weak reference count] : 0x1 [Type: core::sync::atomic::AtomicUsize] |
| 24 | + #check [+0xc00] res : { len=0x1 } [Type: alloc::vec::Vec<alloc::string::String,alloc::alloc::Global>] |
| 25 | + #check [+0x000] nfa [Type: regex::prog::Program] |
| 26 | + #check [+0x320] dfa [Type: regex::prog::Program] |
| 27 | + #check [+0x640] dfa_reverse [Type: regex::prog::Program] |
| 28 | + #check [+0x960] suffixes [Type: regex::literal::imp::LiteralSearcher] |
| 29 | + #check [+0xc18] ac : None [Type: enum$<core::option::Option<aho_corasick::ahocorasick::AhoCorasick<u32> >, 0, 1, Some>] |
| 30 | + #check [+0xda0] match_type : Dfa [Type: enum$<regex::exec::MatchType>] |
| 31 | +
|
| 32 | + dx captures |
| 33 | + #check captures : { named_groups=0x0 } [Type: regex::re_unicode::Captures] |
| 34 | + #check [<Raw View>] [Type: regex::re_unicode::Captures] |
| 35 | + #check [text] : "<Type><hits="12123123123"></hits></Type>" [Type: str] |
| 36 | + #check [named_groups] : { len=0x0 } [Type: @{ .* }@] |
| 37 | + #check [0] : @{ .* }@ : "hits="12123123123"" [Type: char *] |
| 38 | +
|
| 39 | + g |
| 40 | +
|
| 41 | + dx m |
| 42 | + #check m : "hits="12123123123"" [Type: regex::re_unicode::Match] |
| 43 | + #check [<Raw View>] [Type: regex::re_unicode::Match] |
| 44 | + #check [text] : "<Type><hits="12123123123"></hits></Type>" [Type: str] |
| 45 | + #check [match_text] : "hits="12123123123"" |
| 46 | + #check [start] : 0x7 [Type: unsigned __int64] |
| 47 | + #check [end] : 0x19 [Type: unsigned __int64] |
| 48 | +
|
| 49 | + q |
| 50 | +
|
| 51 | +#if not @cdb |
| 52 | + #ignore-test |
| 53 | +
|
| 54 | +***/ |
| 55 | + |
| 56 | +use regex::{Regex, Match}; |
| 57 | + |
| 58 | +pub fn main() { |
| 59 | + let re = Regex::new(r#"hits="[0-9]+""#).unwrap(); |
| 60 | + let text = r#"<Type><hits="12123123123"></hits></Type>"#; |
| 61 | + |
| 62 | + let captures = re.captures(text).unwrap(); |
| 63 | + let matches = captures.iter().filter_map(|capture| capture).collect::<Vec<Match>>(); |
| 64 | + assert_eq!(1, matches.len()); |
| 65 | + _break(); // #break |
| 66 | + |
| 67 | + for m in matches { |
| 68 | + _break(); // #break |
| 69 | + assert_eq!(r#"hits="12123123123""#, m.as_str()); |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +#[inline(never)] |
| 74 | +pub fn _break() {} |
0 commit comments