]> git.lizzy.rs Git - rust.git/blob - tests/camel_case.rs
don't lint similar_names inside #[test] functions
[rust.git] / tests / camel_case.rs
1 #[allow(plugin_as_library)]
2 extern crate clippy;
3
4 use clippy::utils::{camel_case_from, camel_case_until};
5
6 #[test]
7 fn from_full() {
8     assert_eq!(camel_case_from("AbcDef"), 0);
9     assert_eq!(camel_case_from("Abc"), 0);
10 }
11
12 #[test]
13 fn from_partial() {
14     assert_eq!(camel_case_from("abcDef"), 3);
15     assert_eq!(camel_case_from("aDbc"), 1);
16 }
17
18 #[test]
19 fn from_not() {
20     assert_eq!(camel_case_from("AbcDef_"), 7);
21     assert_eq!(camel_case_from("AbcDD"), 5);
22 }
23
24 #[test]
25 fn from_caps() {
26     assert_eq!(camel_case_from("ABCD"), 4);
27 }
28
29 #[test]
30 fn until_full() {
31     assert_eq!(camel_case_until("AbcDef"), 6);
32     assert_eq!(camel_case_until("Abc"), 3);
33 }
34
35 #[test]
36 fn until_not() {
37     assert_eq!(camel_case_until("abcDef"), 0);
38     assert_eq!(camel_case_until("aDbc"), 0);
39 }
40
41 #[test]
42 fn until_partial() {
43     assert_eq!(camel_case_until("AbcDef_"), 6);
44     assert_eq!(camel_case_until("CallTypeC"), 8);
45     assert_eq!(camel_case_until("AbcDD"), 3);
46 }
47
48 #[test]
49 fn until_caps() {
50     assert_eq!(camel_case_until("ABCD"), 0);
51 }