]>
git.proxmox.com Git - rustc.git/blob - src/vendor/regex-0.2.10/tests/test_default.rs
1 // Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![cfg_attr(feature = "pattern", feature(pattern))]
16 // Due to macro scoping rules, this definition only applies for the modules
17 // defined below. Effectively, it allows us to use the same tests for both
18 // native and dynamic regexes.
20 // This is also used to test the various matching engines. This one exercises
21 // the normal code path which automatically chooses the engine based on the
22 // regex and the input. Other dynamic tests explicitly set the engine to use.
23 macro_rules
! regex_new
{
32 regex_new
!($re
).unwrap()
36 macro_rules
! regex_set_new
{
43 macro_rules
! regex_set
{
45 regex_set_new
!($res
).unwrap()
49 // Must come before other module definitions.
50 include
!("macros_str.rs");
51 include
!("macros.rs");
69 mod word_boundary_unicode
;
72 fn disallow_non_utf8() {
73 assert
!(regex
::Regex
::new(r
"(?-u)\xFF").is_err());
74 assert
!(regex
::Regex
::new(r
"(?-u).").is_err());
75 assert
!(regex
::Regex
::new(r
"(?-u)[\xFF]").is_err());
76 assert
!(regex
::Regex
::new(r
"(?-u)☃").is_err());