aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Monnier2013-10-06 23:38:26 -0400
committerStefan Monnier2013-10-06 23:38:26 -0400
commit7ccae3b126e1b01814e8bed7f903f5e2b6d448bd (patch)
treec27b63b78e52c5aa573a46e9a9b94affc015c543 /test
parentc8af480df782d6ff2d99f34a1672b8640dfb673f (diff)
downloademacs-7ccae3b126e1b01814e8bed7f903f5e2b6d448bd.tar.gz
emacs-7ccae3b126e1b01814e8bed7f903f5e2b6d448bd.zip
* lisp/progmodes/ruby-mode.el: Fix recently added tests.
(ruby-smie-grammar): Add - and +. (ruby-smie--redundant-do-p, ruby-smie--forward-id) (ruby-smie--backward-id): New functions. (ruby-smie--forward-token, ruby-smie--backward-token): Use them. (ruby-smie-rules): Handle hanging do. Get rid of hack, not needed any more. * test/indent/ruby.rb: Add a few more tests; adjust some indentation.
Diffstat (limited to 'test')
-rw-r--r--test/indent/ruby.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index e40ef217e54..7c8de323bdb 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -99,6 +99,14 @@ if something == :==
99 do_something 99 do_something
100end 100end
101 101
102# Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html
103d = 4 + 5 + # no '\' needed
104 6 + 7
105
106# Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html
107e = 8 + 9 \
108 + 10 # '\' needed
109
102begin 110begin
103 foo 111 foo
104ensure 112ensure
@@ -109,20 +117,27 @@ end
109MSG = 'Separate every 3 digits in the integer portion of a number' + 117MSG = 'Separate every 3 digits in the integer portion of a number' +
110 'with underscores(_).' 118 'with underscores(_).'
111 119
112# Examples below fail with SMIE. 120class C
121 def foo
122 self.end
123 D.new.class
124 end
125end
113 126
114a = foo(j, k) - 127a = foo(j, k) -
115 bar_tee 128 bar_tee
116 129
117while a < b do # "do" is optional 130while a < b do # "do" is optional
118 foo 131 foo
119end 132end
120 133
121desc "foo foo" \ 134desc "foo foo" \
122 "bar bar" 135 "bar bar"
123 136
124foo. 137foo.
125 bar 138 bar
126 139
140# FIXME: is this really valid Ruby? Isn't the newline after "foo" treated as
141# an implicit semi-colon?
127foo 142foo
128 .bar 143 .bar