buf: add test case for scanner

上级 4337e54a
......@@ -560,6 +560,7 @@ impl Grammar {
) -> Option<MatchRuleResult> {
let mut rule = stack.get_rule(self);
let rule_info = rule.clone().get_rule_instance();
println!("line_text: {:?}, rule_info: {:?}", line_text.clone(), rule.clone().get_rule().id);
let mut rule_scanner;
match rule_info {
......
......@@ -339,4 +339,16 @@ mod tests {
assert_eq!(0, onig_match.clone().capture_indices[0].start);
assert_eq!(1, onig_match.clone().capture_indices[0].end);
}
#[test]
fn should_match_for_scope_target() {
let origin = vec!["^(?!\\t)", "\\G", "^\\t"];
let rules = vec![-1, 36, 39];
let debug_regex = str_vec_to_string(origin);
let mut scanner = Scanner::new(debug_regex);
let result = scanner.find_next_match_sync(String::from("%.o: %.c $(DEPS)
"), 4);
let onig_match = result.unwrap();
println!("{:?}", onig_match);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册