diff options
| author | Dmitry Gutov | 2023-01-17 23:46:41 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2023-01-18 03:27:37 +0200 |
| commit | 9ed9ff4690a8b26ac9729a66aa22f2e14856cd0c (patch) | |
| tree | e22f6db47e121596c62e20ee7cb568661b498f20 /test | |
| parent | c4f0b6ccea128d52a7b4a9ddc1e81dcf13bb25ea (diff) | |
| download | emacs-9ed9ff4690a8b26ac9729a66aa22f2e14856cd0c.tar.gz emacs-9ed9ff4690a8b26ac9729a66aa22f2e14856cd0c.zip | |
ruby-ts-mode: Fix the rules for hanging arrays and hashes
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules):
Fix the rules for hanging arrays and hashes (to line up to
parent-bol instead of the opening brace).
* test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb:
New file with examples.
* test/lisp/progmodes/ruby-ts-mode-tests.el: Use it here.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb | 23 | ||||
| -rw-r--r-- | test/lisp/progmodes/ruby-ts-mode-tests.el | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb b/test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb new file mode 100644 index 00000000000..6b4107ef97b --- /dev/null +++ b/test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | variable = foo( | ||
| 2 | [ | ||
| 3 | qwe | ||
| 4 | ], [ | ||
| 5 | rty | ||
| 6 | ], { | ||
| 7 | a: 3 | ||
| 8 | } | ||
| 9 | ) | ||
| 10 | |||
| 11 | tee = [ | ||
| 12 | qwe | ||
| 13 | ] | ||
| 14 | |||
| 15 | qux = [1, | ||
| 16 | 2] | ||
| 17 | |||
| 18 | att = {a: 1, | ||
| 19 | b: 2} | ||
| 20 | |||
| 21 | # Local Variables: | ||
| 22 | # mode: ruby-ts | ||
| 23 | # End: | ||
diff --git a/test/lisp/progmodes/ruby-ts-mode-tests.el b/test/lisp/progmodes/ruby-ts-mode-tests.el index eaf6367a306..d7b6258385b 100644 --- a/test/lisp/progmodes/ruby-ts-mode-tests.el +++ b/test/lisp/progmodes/ruby-ts-mode-tests.el | |||
| @@ -250,6 +250,7 @@ The whitespace before and including \"|\" on each line is removed." | |||
| 250 | (should (equal (buffer-string) orig)))) | 250 | (should (equal (buffer-string) orig)))) |
| 251 | (kill-buffer buf))))) | 251 | (kill-buffer buf))))) |
| 252 | 252 | ||
| 253 | (ruby-ts-deftest-indent "ruby-ts.rb") | ||
| 253 | (ruby-ts-deftest-indent "ruby-method-params-indent.rb") | 254 | (ruby-ts-deftest-indent "ruby-method-params-indent.rb") |
| 254 | (ruby-ts-deftest-indent "ruby-block-indent.rb") | 255 | (ruby-ts-deftest-indent "ruby-block-indent.rb") |
| 255 | 256 | ||