harper_core/linting/pronoun_contraction/
mod.rs

1use super::merge_linters::merge_linters;
2
3mod avoid_contraction;
4mod should_contract;
5
6use avoid_contraction::AvoidContraction;
7use should_contract::ShouldContract;
8
9merge_linters! {PronounContraction => ShouldContract, AvoidContraction => "Choosing when to contract pronouns is a challenging art. This rule looks for faults." }
10
11#[cfg(test)]
12mod tests {
13    use super::PronounContraction;
14    use crate::linting::tests::{assert_lint_count, assert_suggestion_result};
15
16    #[test]
17    fn issue_225() {
18        assert_suggestion_result(
19            "Your the man",
20            PronounContraction::default(),
21            "You're the man",
22        );
23    }
24
25    #[test]
26    fn were_team() {
27        assert_suggestion_result(
28            "Were the best team.",
29            PronounContraction::default(),
30            "We're the best team.",
31        );
32    }
33
34    #[test]
35    fn issue_139() {
36        assert_suggestion_result(
37            "it would be great if you're PR was merged into tower-lsp",
38            PronounContraction::default(),
39            "it would be great if your PR was merged into tower-lsp",
40        );
41    }
42
43    #[test]
44    fn car() {
45        assert_suggestion_result(
46            "You're car is black.",
47            PronounContraction::default(),
48            "Your car is black.",
49        );
50    }
51
52    #[test]
53    fn allows_you_are_still() {
54        assert_lint_count(
55            "In case you're still not convinced.",
56            PronounContraction::default(),
57            0,
58        );
59    }
60
61    #[test]
62    fn issue_576() {
63        assert_lint_count(
64            "If you're not happy you try again.",
65            PronounContraction::default(),
66            0,
67        );
68        assert_lint_count("No you're not.", PronounContraction::default(), 0);
69        assert_lint_count(
70            "Even if you're not fluent in arm assembly, you surely noticed this.",
71            PronounContraction::default(),
72            0,
73        );
74    }
75}