diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/emacs-lisp/package-tests.el | 2 | ||||
-rw-r--r-- | test/lisp/progmodes/ruby-mode-tests.el | 8 | ||||
-rw-r--r-- | test/manual/indent/ruby.rb | 56 |
3 files changed, 59 insertions, 7 deletions
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 9afdfe67c26..70e129cc4f5 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -466,7 +466,7 @@ Must called from within a `tar-mode' buffer." (cons (format "HOME=%s" homedir) process-environment))) (epg-check-configuration (epg-configuration)) - t) + (epg-find-configuration 'OpenPGP)) (delete-directory homedir t))))) (let* ((keyring (expand-file-name "key.pub" package-test-data-dir)) (package-test-data-dir diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index 4fa7470218a..7e85fb83edd 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el @@ -449,6 +449,14 @@ VALUES-PLIST is a list with alternating index and value elements." ;; It's confused by the closing paren in the middle. (ruby-assert-state s 8 nil))) +(ert-deftest ruby-interpolation-inside-another-interpolation () + :expected-result :failed + (let ((s "\"#{[a, b, c].map { |v| \"#{v}\" }.join}\"")) + (ruby-assert-face s 1 font-lock-string-face) + (ruby-assert-face s 2 font-lock-variable-name-face) + (ruby-assert-face s 38 font-lock-string-face) + (ruby-assert-state s 8 nil))) + (ert-deftest ruby-interpolation-inside-double-quoted-percent-literals () (ruby-assert-face "%Q{foo #@bar}" 8 font-lock-variable-name-face) (ruby-assert-face "%W{foo #@bar}" 8 font-lock-variable-name-face) diff --git a/test/manual/indent/ruby.rb b/test/manual/indent/ruby.rb index 585263d02a6..b038512b114 100644 --- a/test/manual/indent/ruby.rb +++ b/test/manual/indent/ruby.rb @@ -24,8 +24,8 @@ d = %(hello (nested) world) # Don't propertize percent literals inside strings. "(%s, %s)" % [123, 456] -"abc/#{def}ghi" -"abc\#{def}ghi" +"abc/#{ddf}ghi" +"abc\#{ddf}ghi" # Or inside comments. x = # "tot %q/to"; = @@ -222,7 +222,7 @@ foo. bar # https://github.com/rails/rails/blob/17f5d8e062909f1fcae25351834d8e89967b645e/activesupport/lib/active_support/time_with_zone.rb#L206 -foo +foo # comment intended to confuse the tokenizer .bar z = { @@ -295,16 +295,38 @@ foo > bar && tee < qux zux do - foo == bar and + foo == bar && tee == qux + + a = 3 and + b = 4 end +foo + bar == + tee + qux + +1 .. 2 && + 3 + +3 < 4 + + 5 + +10 << 4 ^ + 20 + +100 + 2 >> + 3 + +2 ** 10 / + 2 + foo ^ bar foo_bar_tee(1, 2, 3) - .qux.bar - .tee + .qux&.bar + .tee.bar + &.tee foo do bar @@ -316,6 +338,11 @@ def bar .baz end +abc(foo + .bar, + tee + .qux) + # http://stackoverflow.com/questions/17786563/emacs-ruby-mode-if-expressions-indentation tee = if foo bar @@ -399,6 +426,17 @@ zoo a.records().map(&:b).zip( foo) +foo1 = + subject.update( + 1 + ) + +foo2 = + subject. + update( + 2 + ) + # FIXME: This is not consistent with the example below it, but this # offset only happens if the colon is at eol, which wouldn't be often. # Tokenizing `bar:' as `:bar =>' would be better, but it's hard to @@ -409,6 +447,12 @@ foo(bar: foo(:bar => tee) +regions = foo( + OpenStruct.new(id: 0, name: "foo") => [ + 10 + ] +) + {'a' => { 'b' => 'c', 'd' => %w(e f) |