mirror of
https://gitee.com/openharmony/third_party_rust_regex
synced 2025-04-15 00:49:56 +00:00

Fixes #31 and #33. There are a number of related changes in this commit: 1. A script that generates the 'match' tests has been reintroduced. 2. The regex-dna shootout benchmark has been updated. 3. Running `cargo test` on the `regex` crate does not require `regex_macros`. 4. The documentation has been updated to use `Regex::new(...).unwrap()` instead of `regex!`. The emphasis on using `regex!` has been reduced, and a note about its unavailability in Rust 1.0 beta/stable has been added. 5. Updated Travis to test both `regex` and `regex_macros`.
30 lines
915 B
Rust
30 lines
915 B
Rust
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
// file at the top-level directory of this distribution and at
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
#![feature(core, test)]
|
|
|
|
extern crate rand;
|
|
extern crate regex;
|
|
extern crate test;
|
|
|
|
// Due to macro scoping rules, this definition only applies for the modules
|
|
// defined below. Effectively, it allows us to use the same tests for both
|
|
// native and dynamic regexes.
|
|
macro_rules! regex(
|
|
($re:expr) => (
|
|
match ::regex::Regex::new($re) {
|
|
Ok(re) => re,
|
|
Err(err) => panic!("{}", err),
|
|
}
|
|
);
|
|
);
|
|
|
|
mod bench;
|