summaryrefslogtreecommitdiff
path: root/rust-mode-tests.el
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-06-03 07:10:01 -0600
committerTom Tromey <tom@tromey.com>2017-08-14 00:36:45 -0600
commit38f7d891e62ce8bb8ff60a8126fb4ce06af5b6b5 (patch)
tree3d70674852b81ecf156ce0e081335ef06c4d59dc /rust-mode-tests.el
parente48a650c44c06c1dd4e4ed0672c50c5446124203 (diff)
downloadrust-mode-38f7d891e62ce8bb8ff60a8126fb4ce06af5b6b5.tar.gz
Fix recognition of "<" as operator in some context
rust-mode identifies the "<<" as open angle brackets in let x = a[i][(1 << i)]; This patch fixes the problem by changing rust-is-in-expression-context to treat "]" as starting an expression in brace context. Fixes #212
Diffstat (limited to 'rust-mode-tests.el')
-rw-r--r--rust-mode-tests.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index 7335334..aab82df 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -2034,6 +2034,17 @@ fn main() {
baz();
}"))
+;; Regression test for #212.
+(ert-deftest indent-left-shift ()
+ (test-indent "
+fn main() {
+ let a = [[0u32, 0u32]; 1];
+ let i = 0;
+ let x = a[i][(1 < i)];
+ let x = a[i][(1 << i)];
+}
+"))
+
(defun rust-test-matching-parens (content pairs &optional nonparen-positions)
"Assert that in rust-mode, given a buffer with the given `content',
emacs's paren matching will find all of the pairs of positions