summaryrefslogtreecommitdiff
path: root/rust-mode-tests.el
diff options
context:
space:
mode:
authormrBliss <dewinant@gmail.com>2016-04-25 10:34:17 +0200
committermrBliss <dewinant@gmail.com>2016-04-25 10:34:17 +0200
commiteafb7a0fcdc9f619716873ce49009c6966a30ca9 (patch)
tree23b27e97322b25a00c7d1ba3b936c0bd7d131095 /rust-mode-tests.el
parentb971c6dd1c9356d4ace237c7e173dcbcb454a992 (diff)
downloadrust-mode-eafb7a0fcdc9f619716873ce49009c6966a30ca9.tar.gz
Properly fix #151
Always check whether we're not in a string or comment when looking for the `where` keyword. Use two helpers for this: `rust-looking-at-where` and `rust-rewind-to-where`.
Diffstat (limited to 'rust-mode-tests.el')
-rw-r--r--rust-mode-tests.el23
1 files changed, 22 insertions, 1 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index 1e0207d..1e60768 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -623,7 +623,7 @@ impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
}
"))
-(ert-deftest indent-align-where-in-comment ()
+(ert-deftest indent-align-where-in-comment1 ()
(test-indent
"/// - there must not exist an edge U->V in the graph where:
#[derive(Clone, PartialEq, Eq)]
@@ -633,6 +633,27 @@ pub struct Region { // <-- this should be flush with left margin!
}
"))
+(ert-deftest indent-align-where-in-comment2 ()
+ (test-indent
+ "fn foo<F,G>(f:F, g:G)
+ where F:Send,
+// where
+ G:Sized
+{
+ let body;
+}
+"))
+
+(ert-deftest indent-align-where-in-comment3 ()
+ (test-indent
+ "fn foo<F,G>(f:F, g:G)
+ where F:Send,
+// where F:ThisIsNotActualCode,
+ G:Sized
+{
+ let body;
+}
+"))
(ert-deftest indent-square-bracket-alignment ()
(test-indent