File tree 7 files changed +44
-25
lines changed
compile-fail-regex_macros 7 files changed +44
-25
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,8 @@ sudo: false
4
4
5
5
script :
6
6
- python util/update_lints.py -c
7
+ - cargo build --features debugging
7
8
- cargo test --features debugging
9
+
10
+ # only test regex_macros if it compiles
11
+ - if [[ "$(cargo build --features 'debugging test-regex_macros')" = 101 ]]; then cargo test --features 'debugging test-regex_macros'; fi
Original file line number Diff line number Diff line change @@ -18,17 +18,17 @@ name = "clippy"
18
18
plugin = true
19
19
20
20
[dependencies ]
21
- unicode-normalization = " 0.1"
22
- semver = " 0.2.1"
23
21
regex-syntax = " 0.2.2"
22
+ regex_macros = { version = " 0.1.28" , optional = true }
23
+ semver = " 0.2.1"
24
+ unicode-normalization = " 0.1"
24
25
25
26
[dev-dependencies ]
26
27
compiletest_rs = " 0.0.11"
27
- regex = " 0.1.47"
28
- regex_macros = " 0.1.28"
29
28
lazy_static = " 0.1.15"
29
+ regex = " 0.1.47"
30
30
rustc-serialize = " 0.3"
31
31
32
32
[features ]
33
-
34
33
debugging = []
34
+ test-regex_macros = [" regex_macros" ]
Original file line number Diff line number Diff line change
1
+ #![ feature( plugin) ]
2
+ #![ plugin( clippy, regex_macros) ]
3
+
4
+ #![ allow( unused) ]
5
+ #![ deny( invalid_regex, trivial_regex, regex_macro) ]
6
+
7
+ extern crate regex;
8
+
9
+ fn main ( ) {
10
+ let some_regex = regex ! ( "for real!" ) ; //~ERROR `regex!(_)`
11
+ let other_regex = regex ! ( "[a-z]_[A-Z]" ) ; //~ERROR `regex!(_)`
12
+ }
Original file line number Diff line number Diff line change 1
1
#![ feature( plugin) ]
2
- #![ plugin( clippy, regex_macros ) ]
2
+ #![ plugin( clippy) ]
3
3
4
4
#![ allow( unused) ]
5
5
#![ deny( invalid_regex, trivial_regex, regex_macro) ]
@@ -70,14 +70,7 @@ fn trivial_regex() {
70
70
let non_trivial_ends_with = Regex :: new ( "foo|bar" ) ;
71
71
}
72
72
73
- fn regex_macro ( ) {
74
- let some_regex = regex ! ( "for real!" ) ; //~ERROR `regex!(_)`
75
- let other_regex = regex ! ( "[a-z]_[A-Z]" ) ; //~ERROR `regex!(_)`
76
- }
77
-
78
-
79
73
fn main ( ) {
80
- regex_macro ( ) ;
81
74
syntax_error ( ) ;
82
75
trivial_regex ( ) ;
83
76
}
Original file line number Diff line number Diff line change @@ -20,7 +20,15 @@ fn run_mode(mode: &'static str) {
20
20
}
21
21
22
22
#[ test]
23
+ #[ cfg( not( feature = "test-regex_macros" ) ) ]
23
24
fn compile_test ( ) {
24
25
run_mode ( "run-pass" ) ;
25
26
run_mode ( "compile-fail" ) ;
26
27
}
28
+
29
+ #[ test]
30
+ #[ cfg( feature = "test-regex_macros" ) ]
31
+ fn compile_test ( ) {
32
+ run_mode ( "run-pass-regex_macros" ) ;
33
+ run_mode ( "compile-fail-regex_macros" ) ;
34
+ }
Original file line number Diff line number Diff line change
1
+ #![ feature( plugin) ]
2
+ #![ plugin( clippy, regex_macros) ]
3
+
4
+ #[ macro_use]
5
+ extern crate regex;
6
+
7
+ #[ deny( mut_mut) ]
8
+ #[ allow( regex_macro) ]
9
+ fn main ( ) {
10
+ let pattern = regex ! ( r"^(?P<level>[#]+)\s(?P<title>.+)$" ) ;
11
+ assert ! ( pattern. is_match( "# headline" ) ) ;
12
+ }
Original file line number Diff line number Diff line change 1
1
#![ feature( plugin) ]
2
- #![ plugin( clippy, regex_macros ) ]
2
+ #![ plugin( clippy) ]
3
3
4
4
#[ macro_use]
5
5
extern crate lazy_static;
6
- extern crate regex;
7
6
8
7
use std:: collections:: HashMap ;
9
8
10
- #[ test]
11
- #[ deny( mut_mut) ]
12
- #[ allow( regex_macro) ]
13
- fn test_regex ( ) {
14
- let pattern = regex ! ( r"^(?P<level>[#]+)\s(?P<title>.+)$" ) ;
15
- assert ! ( pattern. is_match( "# headline" ) ) ;
16
- }
17
-
18
- #[ test]
19
9
#[ deny( mut_mut) ]
20
10
#[ allow( unused_variables, unused_mut) ]
21
- fn test_lazy_static ( ) {
11
+ fn main ( ) {
22
12
lazy_static ! {
23
13
static ref MUT_MAP : HashMap <usize , & ' static str > = {
24
14
let mut m = HashMap :: new( ) ;
You can’t perform that action at this time.
0 commit comments