diff options
| author | Felix S Klock II <pnkfelix@pnkfx.org> | 2015-12-02 14:02:49 +0100 |
|---|---|---|
| committer | Felix S Klock II <pnkfelix@pnkfx.org> | 2015-12-02 14:02:49 +0100 |
| commit | eaf95af109b2f90441fb4976678b1f058d2c4de8 (patch) | |
| tree | 70c57f5b01521ee306a65b31a458bdd38b100aa7 /rust-mode-tests.el | |
| parent | 0601540d43b901b0ad0ec62363a143cd3a054364 (diff) | |
| parent | 92584c303acc417501d1faa593ff1392fd306c1d (diff) | |
| download | rust-mode-eaf95af109b2f90441fb4976678b1f058d2c4de8.tar.gz | |
Merge pull request #111 from mrBliss/where-indentation
Correctly indent where clauses
Diffstat (limited to 'rust-mode-tests.el')
| -rw-r--r-- | rust-mode-tests.el | 171 |
1 files changed, 171 insertions, 0 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el index e621f82..cc76007 100644 --- a/rust-mode-tests.el +++ b/rust-mode-tests.el @@ -443,6 +443,177 @@ fn foo4(a:int, } ")) +(ert-deftest indent-body-after-where () + (test-indent + " +fn foo1(a: A, b: B) -> A + where A: Clone + Default, B: Eq { + let body; + Foo { + bar: 3 + } +} + +fn foo2(a: A, b: B) -> A + where A: Clone + Default, B: Eq +{ + let body; + Foo { + bar: 3 + } +} +")) + +(ert-deftest indent-align-where-clauses-style1a () + (test-indent + " +fn foo1a(a: A, b: B, c: C) -> D + where A: Clone + Default, + B: Eq, + C: PartialEq, + D: PartialEq { + let body; + Foo { + bar: 3 + } +} +")) + +(ert-deftest indent-align-where-clauses-style1b () + (test-indent + " +fn foo1b(a: A, b: B, c: C) -> D + where A: Clone + Default, + B: Eq, + C: PartialEq, + D: PartialEq +{ + let body; + Foo { + bar: 3 + } +} +")) + +(ert-deftest indent-align-where-clauses-style2a () + (test-indent + " +fn foo2a(a: A, b: B, c: C) -> D where A: Clone + Default, + B: Eq, + C: PartialEq, + D: PartialEq { + let body; + Foo { + bar: 3 + } +} +")) + +(ert-deftest indent-align-where-clauses-style2b () + (test-indent + " +fn foo2b(a: A, b: B, c: C) -> D where A: Clone + Default, + B: Eq, + C: PartialEq, + D: PartialEq +{ + let body; + Foo { + bar: 3 + } +} +")) + +(ert-deftest indent-align-where-clauses-style3a () + (test-indent + " +fn foo3a(a: A, b: B, c: C) -> D where + A: Clone + Default, + B: Eq, + C: PartialEq, + D: PartialEq { + let body; + Foo { + bar: 3 + } +} +")) + +(ert-deftest indent-align-where-clauses-style3b () + (test-indent + " +fn foo3b(a: A, b: B, c: C) -> D where + A: Clone + Default, + B: Eq, + C: PartialEq, + D: PartialEq +{ + let body; + Foo { + bar: 3 + } +} +")) + +(ert-deftest indent-align-where-clauses-style4a () + (let ((rust-indent-where-clause nil)) + (test-indent + " +fn foo4a(a: A, b: B, c: C) -> D +where A: Clone + Default, + B: Eq, + C: PartialEq, + D: PartialEq { + let body; + Foo { + bar: 3 + } +} +"))) + +(ert-deftest indent-align-where-clauses-style4b () + (let ((rust-indent-where-clause nil)) + (test-indent + " +fn foo4b(a: A, b: B, c: C) -> D +where A: Clone + Default, + B: Eq, + C: PartialEq, + D: PartialEq +{ + let body; + Foo { + bar: 3 + } +} +"))) + +(ert-deftest indent-align-where-clauses-impl-example () + (test-indent + " +impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S> + where K: Eq + Hash + Borrow<Q>, + Q: Eq + Hash, + S: HashState, +{ + let body; + Foo { + bar: 3 + } +} +")) + +(ert-deftest indent-align-where-clauses-first-line () + (test-indent + "fn foo1(a: A, b: B) -> A + where A: Clone + Default, B: Eq { + let body; + Foo { + bar: 3 + } +} +")) + (ert-deftest indent-square-bracket-alignment () (test-indent " |
