gecko-dev/third_party/rust/regex-0.2.2/tests/test_default.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

78 строки
1.9 KiB
Rust
Исходник Обычный вид История

Bug 1463251 - Part 2. Revendor dependencies. r=ato,jgraham MozReview-Commit-ID: 6eeqvTqSxam --HG-- rename : third_party/rust/memchr/.cargo-checksum.json => third_party/rust/memchr-1.0.2/.cargo-checksum.json rename : third_party/rust/memchr/Cargo.toml => third_party/rust/memchr-1.0.2/Cargo.toml rename : third_party/rust/memchr/src/lib.rs => third_party/rust/memchr-1.0.2/src/lib.rs rename : third_party/rust/regex/.cargo-checksum.json => third_party/rust/regex-0.2.2/.cargo-checksum.json rename : third_party/rust/regex/.travis.yml => third_party/rust/regex-0.2.2/.travis.yml rename : third_party/rust/regex/CHANGELOG.md => third_party/rust/regex-0.2.2/CHANGELOG.md rename : third_party/rust/regex/Cargo.toml => third_party/rust/regex-0.2.2/Cargo.toml rename : third_party/rust/regex/HACKING.md => third_party/rust/regex-0.2.2/HACKING.md rename : third_party/rust/regex/PERFORMANCE.md => third_party/rust/regex-0.2.2/PERFORMANCE.md rename : third_party/rust/regex/README.md => third_party/rust/regex-0.2.2/README.md rename : third_party/rust/regex/appveyor.yml => third_party/rust/regex-0.2.2/appveyor.yml rename : third_party/rust/regex/ci/after_success.sh => third_party/rust/regex-0.2.2/ci/after_success.sh rename : third_party/rust/regex/ci/run-kcov => third_party/rust/regex-0.2.2/ci/run-kcov rename : third_party/rust/regex/ci/script.sh => third_party/rust/regex-0.2.2/ci/script.sh rename : third_party/rust/regex/examples/bug347.rs => third_party/rust/regex-0.2.2/examples/bug347.rs rename : third_party/rust/regex/examples/shootout-regex-dna-bytes.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-dna-bytes.rs rename : third_party/rust/regex/examples/shootout-regex-dna-single.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-dna-single.rs rename : third_party/rust/regex/examples/shootout-regex-dna.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-dna.rs rename : third_party/rust/regex/examples/shootout-regex-redux-1.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-redux-1.rs rename : third_party/rust/regex/examples/shootout-regex-redux-chunked.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-redux-chunked.rs rename : third_party/rust/regex/examples/shootout-regex-redux.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-redux.rs rename : third_party/rust/regex/scripts/unicode.py => third_party/rust/regex-0.2.2/scripts/unicode.py rename : third_party/rust/regex/src/backtrack.rs => third_party/rust/regex-0.2.2/src/backtrack.rs rename : third_party/rust/regex/src/compile.rs => third_party/rust/regex-0.2.2/src/compile.rs rename : third_party/rust/regex/src/dfa.rs => third_party/rust/regex-0.2.2/src/dfa.rs rename : third_party/rust/regex/src/error.rs => third_party/rust/regex-0.2.2/src/error.rs rename : third_party/rust/regex/src/exec.rs => third_party/rust/regex-0.2.2/src/exec.rs rename : third_party/rust/regex/src/expand.rs => third_party/rust/regex-0.2.2/src/expand.rs rename : third_party/rust/regex/src/input.rs => third_party/rust/regex-0.2.2/src/input.rs rename : third_party/rust/regex/src/lib.rs => third_party/rust/regex-0.2.2/src/lib.rs rename : third_party/rust/regex/src/literals.rs => third_party/rust/regex-0.2.2/src/literals.rs rename : third_party/rust/regex/src/pikevm.rs => third_party/rust/regex-0.2.2/src/pikevm.rs rename : third_party/rust/regex/src/prog.rs => third_party/rust/regex-0.2.2/src/prog.rs rename : third_party/rust/regex/src/re_builder.rs => third_party/rust/regex-0.2.2/src/re_builder.rs rename : third_party/rust/regex/src/re_bytes.rs => third_party/rust/regex-0.2.2/src/re_bytes.rs rename : third_party/rust/regex/src/re_plugin.rs => third_party/rust/regex-0.2.2/src/re_plugin.rs rename : third_party/rust/regex/src/re_set.rs => third_party/rust/regex-0.2.2/src/re_set.rs rename : third_party/rust/regex/src/re_trait.rs => third_party/rust/regex-0.2.2/src/re_trait.rs rename : third_party/rust/regex/src/re_unicode.rs => third_party/rust/regex-0.2.2/src/re_unicode.rs rename : third_party/rust/regex/src/simd_accel/mod.rs => third_party/rust/regex-0.2.2/src/simd_accel/mod.rs rename : third_party/rust/regex/src/simd_accel/teddy128.rs => third_party/rust/regex-0.2.2/src/simd_accel/teddy128.rs rename : third_party/rust/regex/src/simd_fallback/mod.rs => third_party/rust/regex-0.2.2/src/simd_fallback/mod.rs rename : third_party/rust/regex/src/simd_fallback/teddy128.rs => third_party/rust/regex-0.2.2/src/simd_fallback/teddy128.rs rename : third_party/rust/regex/src/utf8.rs => third_party/rust/regex-0.2.2/src/utf8.rs rename : third_party/rust/regex/tests/api_str.rs => third_party/rust/regex-0.2.2/tests/api_str.rs rename : third_party/rust/regex/tests/bytes.rs => third_party/rust/regex-0.2.2/tests/bytes.rs rename : third_party/rust/regex/tests/crazy.rs => third_party/rust/regex-0.2.2/tests/crazy.rs rename : third_party/rust/regex/tests/macros.rs => third_party/rust/regex-0.2.2/tests/macros.rs rename : third_party/rust/regex/tests/macros_bytes.rs => third_party/rust/regex-0.2.2/tests/macros_bytes.rs rename : third_party/rust/regex/tests/macros_str.rs => third_party/rust/regex-0.2.2/tests/macros_str.rs rename : third_party/rust/regex/tests/noparse.rs => third_party/rust/regex-0.2.2/tests/noparse.rs rename : third_party/rust/regex/tests/plugin.rs => third_party/rust/regex-0.2.2/tests/plugin.rs rename : third_party/rust/regex/tests/regression.rs => third_party/rust/regex-0.2.2/tests/regression.rs rename : third_party/rust/regex/tests/replace.rs => third_party/rust/regex-0.2.2/tests/replace.rs rename : third_party/rust/regex/tests/test_default.rs => third_party/rust/regex-0.2.2/tests/test_default.rs rename : third_party/rust/regex/tests/test_default_bytes.rs => third_party/rust/regex-0.2.2/tests/test_default_bytes.rs rename : third_party/rust/regex/tests/test_plugin.rs => third_party/rust/regex-0.2.2/tests/test_plugin.rs rename : third_party/rust/regex/tests/unicode.rs => third_party/rust/regex-0.2.2/tests/unicode.rs rename : third_party/rust/regex/tests/word_boundary_unicode.rs => third_party/rust/regex-0.2.2/tests/word_boundary_unicode.rs rename : third_party/rust/regex-syntax/.cargo-checksum.json => third_party/rust/regex-syntax-0.4.1/.cargo-checksum.json rename : third_party/rust/regex-syntax/Cargo.toml => third_party/rust/regex-syntax-0.4.1/Cargo.toml rename : third_party/rust/regex-syntax/src/lib.rs => third_party/rust/regex-syntax-0.4.1/src/lib.rs rename : third_party/rust/regex-syntax/src/literals.rs => third_party/rust/regex-syntax-0.4.1/src/literals.rs rename : third_party/rust/regex-syntax/src/parser.rs => third_party/rust/regex-syntax-0.4.1/src/parser.rs rename : third_party/rust/regex-syntax/src/properties.rs => third_party/rust/regex-syntax-0.4.1/src/properties.rs rename : third_party/rust/regex-syntax/src/unicode.rs => third_party/rust/regex-syntax-0.4.1/src/unicode.rs extra : rebase_source : b0c643eb68b9262945345145ec1578c14369dbf7
2018-05-21 23:34:18 +03:00
// Copyright 2014-2015 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.
#![cfg_attr(feature = "pattern", feature(pattern))]
extern crate rand;
extern crate regex;
// 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.
//
// This is also used to test the various matching engines. This one exercises
// the normal code path which automatically chooses the engine based on the
// regex and the input. Other dynamic tests explicitly set the engine to use.
macro_rules! regex_new {
($re:expr) => {{
use regex::Regex;
Regex::new($re)
}}
}
macro_rules! regex {
($re:expr) => {
regex_new!($re).unwrap()
}
}
macro_rules! regex_set_new {
($re:expr) => {{
use regex::RegexSet;
RegexSet::new($re)
}}
}
macro_rules! regex_set {
($res:expr) => {
regex_set_new!($res).unwrap()
}
}
// Must come before other module definitions.
include!("macros_str.rs");
include!("macros.rs");
mod api;
mod api_str;
mod crazy;
mod flags;
mod fowler;
mod misc;
mod multiline;
mod noparse;
mod regression;
mod replace;
mod searcher;
mod set;
mod shortest_match;
mod suffix_reverse;
mod unicode;
mod word_boundary;
mod word_boundary_unicode;
#[test]
fn disallow_non_utf8() {
assert!(regex::Regex::new(r"(?-u)\xFF").is_err());
assert!(regex::Regex::new(r"(?-u).").is_err());
assert!(regex::Regex::new(r"(?-u)[\xFF]").is_err());
assert!(regex::Regex::new(r"(?-u)☃").is_err());
}