diff options
| author | Stefan Monnier | 2013-05-08 16:25:57 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-05-08 16:25:57 -0400 |
| commit | a9e4425bc99733b6ecf3898801b6595f35c4ef30 (patch) | |
| tree | 903ca31485cda0ddef4de71a44ed8283542a6d88 /test | |
| parent | 060ca4088d928e0808d13a551ea11b2fc00769d4 (diff) | |
| download | emacs-a9e4425bc99733b6ecf3898801b6595f35c4ef30.tar.gz emacs-a9e4425bc99733b6ecf3898801b6595f35c4ef30.zip | |
* lisp/progmodes/ruby-mode.el: First cut at SMIE support.
(ruby-use-smie): New var.
(ruby-smie-grammar): New constant.
(ruby-smie--bosp, ruby-smie--implicit-semi-p)
(ruby-smie--forward-token, ruby-smie--backward-token)
(ruby-smie-rules): New functions.
(ruby-mode-variables): Setup SMIE if applicable.
* test/indent/ruby.rb: Fix indentation after =; add more cases.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 4 | ||||
| -rw-r--r-- | test/indent/ruby.rb | 36 |
2 files changed, 39 insertions, 1 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 48d499a9fa4..c11d5d26c13 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-05-08 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * indent/ruby.rb: Fix indentation after =; add more cases. | ||
| 4 | |||
| 1 | 2013-05-05 Stefan Monnier <monnier@iro.umontreal.ca> | 5 | 2013-05-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 6 | ||
| 3 | * indent/pascal.pas: Add test for mis-identified comments. | 7 | * indent/pascal.pas: Add test for mis-identified comments. |
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index 4f2e9e63377..90c6dcdc65c 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb | |||
| @@ -10,7 +10,7 @@ d = %(hello (nested) world) | |||
| 10 | 10 | ||
| 11 | # Or inside comments. | 11 | # Or inside comments. |
| 12 | x = # "tot %q/to"; = | 12 | x = # "tot %q/to"; = |
| 13 | y = 2 / 3 | 13 | y = 2 / 3 |
| 14 | 14 | ||
| 15 | # Regexp after whitelisted method. | 15 | # Regexp after whitelisted method. |
| 16 | "abc".sub /b/, 'd' | 16 | "abc".sub /b/, 'd' |
| @@ -21,6 +21,40 @@ a = asub / aslb + bsub / bslb; | |||
| 21 | # Highlight the regexp after "if". | 21 | # Highlight the regexp after "if". |
| 22 | x = toto / foo if /do bar/ =~ "dobar" | 22 | x = toto / foo if /do bar/ =~ "dobar" |
| 23 | 23 | ||
| 24 | def test1(arg) | ||
| 25 | puts "hello" | ||
| 26 | end | ||
| 27 | |||
| 28 | def test2 (arg) | ||
| 29 | a = "apple" | ||
| 30 | |||
| 31 | if a == 2 | ||
| 32 | puts "hello" | ||
| 33 | else | ||
| 34 | puts "there" | ||
| 35 | end | ||
| 36 | |||
| 37 | if a == 2 then | ||
| 38 | puts "hello" | ||
| 39 | elsif a == 3 | ||
| 40 | puts "hello3" | ||
| 41 | elsif a == 3 then | ||
| 42 | puts "hello3" | ||
| 43 | else | ||
| 44 | puts "there" | ||
| 45 | end | ||
| 46 | |||
| 47 | case a | ||
| 48 | when "a" | ||
| 49 | 6 | ||
| 50 | # when "b" : | ||
| 51 | # 7 | ||
| 52 | # when "c" : 2 | ||
| 53 | when "d" then 4 | ||
| 54 | else 5 | ||
| 55 | end | ||
| 56 | end | ||
| 57 | |||
| 24 | # Some Cucumber code: | 58 | # Some Cucumber code: |
| 25 | Given /toto/ do | 59 | Given /toto/ do |
| 26 | print "hello" | 60 | print "hello" |