diff options
Diffstat (limited to 'test/manual/indent')
-rw-r--r-- | test/manual/indent/css-mode.css | 84 | ||||
-rw-r--r-- | test/manual/indent/js-chain.js | 29 | ||||
-rw-r--r-- | test/manual/indent/js-indent-align-list-continuation-nil.js | 20 | ||||
-rw-r--r-- | test/manual/indent/js-indent-init-dynamic.js | 30 | ||||
-rw-r--r-- | test/manual/indent/js-indent-init-t.js | 21 | ||||
-rw-r--r-- | test/manual/indent/js-jsx.js | 85 | ||||
-rw-r--r-- | test/manual/indent/js.js | 141 | ||||
-rw-r--r-- | test/manual/indent/latex-mode.tex | 4 | ||||
-rw-r--r-- | test/manual/indent/less-css-mode.less | 10 | ||||
-rw-r--r-- | test/manual/indent/nxml.xml | 10 | ||||
-rw-r--r-- | test/manual/indent/octave.m | 4 | ||||
-rw-r--r-- | test/manual/indent/pascal.pas | 2 | ||||
-rwxr-xr-x | test/manual/indent/perl.perl | 32 | ||||
-rw-r--r-- | test/manual/indent/ps-mode.ps | 14 | ||||
-rw-r--r-- | test/manual/indent/ruby.rb | 477 | ||||
-rw-r--r-- | test/manual/indent/scheme.scm | 32 | ||||
-rw-r--r-- | test/manual/indent/scss-mode.scss | 10 | ||||
-rwxr-xr-x | test/manual/indent/shell.sh | 7 | ||||
-rw-r--r-- | test/manual/indent/tcl.tcl | 26 |
19 files changed, 115 insertions, 923 deletions
diff --git a/test/manual/indent/css-mode.css b/test/manual/indent/css-mode.css deleted file mode 100644 index bf612b53a14..00000000000 --- a/test/manual/indent/css-mode.css +++ /dev/null @@ -1,84 +0,0 @@ -/* asdfasdf */ - -.xxx -{ -} - -article[role="main"] { - width: 60%; -} - -a, b:hover, c { - color: black !important; -} - -a, b:hover { /* bug:20282 */ - c { - color: black; - } - color: black; -} - -a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { /* bug:20282 */ - background-color: white; -} - -/* asdfasdf */ -@foo x2 { - bla:toto; -} -.x2 -{ - /* foo: bar; */ foo2: bar2; - bar1: url("http://toto/titi"); - bar2: url('http://toto/titi'); - bar3: url(http://toto/titi); -} - -div.x3 -{ -} - -article:hover -{ - color: black; -} - -/* bug:13425 */ -div:first-child, -div:last-child, -div[disabled], -div::before { - font: 15px "Helvetica Neue", - Helvetica, - Arial, - "Nimbus Sans L", - sans-serif; - font: 15px "Helvetica Neue", Helvetica, Arial, - "Nimbus Sans L", sans-serif; - transform: matrix(1.0, 2.0, - 3.0, 4.0, - 5.0, 6.0); - transform: matrix( - 1.0, 2.0, - 3.0, 4.0, - 5.0, 6.0 - ); -} - -@font-face { - src: url("Sans-Regular.eot") format("eot"), - url("Sans-Regular.woff") format("woff"), - url("Sans-Regular.ttf") format("truetype"); -} - -@font-face { - src: - url("Sans-Regular.eot") format("eot"), - url("Sans-Regular.woff") format("woff"); -} - -.foo-bar--baz { - --foo-variable: 5px; - margin: var(--foo-variable); -} diff --git a/test/manual/indent/js-chain.js b/test/manual/indent/js-chain.js deleted file mode 100644 index 2a290294026..00000000000 --- a/test/manual/indent/js-chain.js +++ /dev/null @@ -1,29 +0,0 @@ -// Normal chaining. -let x = svg.mumble() - .zzz; - -// Chaining with an intervening line comment. -let x = svg.mumble() // line comment - .zzz; - -// Chaining with multiple dots. -let x = svg.selectAll().something() - .zzz; - -// Nested chaining. -let x = svg.selectAll(d3.svg.something() - .zzz); - -// Nothing to chain to. -let x = svg() - .zzz; - -// Nothing to chain to. -let x = svg().mumble.x() + 73 - .zzz; - -// Local Variables: -// indent-tabs-mode: nil -// js-chain-indent: t -// js-indent-level: 2 -// End: diff --git a/test/manual/indent/js-indent-align-list-continuation-nil.js b/test/manual/indent/js-indent-align-list-continuation-nil.js deleted file mode 100644 index 383b2539a26..00000000000 --- a/test/manual/indent/js-indent-align-list-continuation-nil.js +++ /dev/null @@ -1,20 +0,0 @@ -const funcAssignment = function (arg1, - arg2, - arg3) { - return { test: this, - which: "would", - align: "as well with the default setting" - }; -} - -function funcDeclaration(arg1, - arg2 -) { - return [arg1, - arg2]; -} - -// Local Variables: -// indent-tabs-mode: nil -// js-indent-align-list-continuation: nil -// End: diff --git a/test/manual/indent/js-indent-init-dynamic.js b/test/manual/indent/js-indent-init-dynamic.js deleted file mode 100644 index 536a976e86e..00000000000 --- a/test/manual/indent/js-indent-init-dynamic.js +++ /dev/null @@ -1,30 +0,0 @@ -var foo = function() { - return 7; -}; - -var foo = function() { - return 7; - }, - bar = 8; - -var foo = function() { - return 7; - }, - bar = function() { - return 8; - }; - -// Local Variables: -// indent-tabs-mode: nil -// js-indent-level: 2 -// js-indent-first-init: dynamic -// End: - -// The following test intentionally produces a scan error and should -// be placed below all other tests to prevent awkward indentation. -// (It still thinks it's within the body of a function.) - -var foo = function() { - return 7; - , - bar = 8; diff --git a/test/manual/indent/js-indent-init-t.js b/test/manual/indent/js-indent-init-t.js deleted file mode 100644 index bb755420ba7..00000000000 --- a/test/manual/indent/js-indent-init-t.js +++ /dev/null @@ -1,21 +0,0 @@ -var foo = function() { - return 7; - }; - -var foo = function() { - return 7; - }, - bar = 8; - -var foo = function() { - return 7; - }, - bar = function() { - return 8; - }; - -// Local Variables: -// indent-tabs-mode: nil -// js-indent-level: 2 -// js-indent-first-init: t -// End: diff --git a/test/manual/indent/js-jsx.js b/test/manual/indent/js-jsx.js deleted file mode 100644 index 7401939d282..00000000000 --- a/test/manual/indent/js-jsx.js +++ /dev/null @@ -1,85 +0,0 @@ -// -*- mode: js-jsx; -*- - -var foo = <div></div>; - -return ( - <div> - </div> - <div> - <div></div> - <div> - <div></div> - </div> - </div> -); - -React.render( - <div> - <div></div> - </div>, - { - a: 1 - }, - <div> - <div></div> - </div> -); - -return ( - // Sneaky! - <div></div> -); - -return ( - <div></div> - // Sneaky! -); - -React.render( - <input - />, - { - a: 1 - } -); - -return ( - <div> - {array.map(function () { - return { - a: 1 - }; - })} - </div> -); - -return ( - <div attribute={array.map(function () { - return { - a: 1 - }; - - return { - a: 1 - }; - - return { - a: 1 - }; - })}> - </div> -); - -// Local Variables: -// indent-tabs-mode: nil -// js-indent-level: 2 -// End: - -// The following test has intentionally unclosed elements and should -// be placed below all other tests to prevent awkward indentation. - -return ( - <div> - {array.map(function () { - return { - a: 1 diff --git a/test/manual/indent/js.js b/test/manual/indent/js.js deleted file mode 100644 index 1ad76a83e18..00000000000 --- a/test/manual/indent/js.js +++ /dev/null @@ -1,141 +0,0 @@ -var a = 1; -b = 2; - -let c = 1, - d = 2; - -var e = 100500, - + 1; - -function test () -{ - return /[/]/.test ('/') // (bug#19397) -} - -var f = bar('/protocols/') -baz(); - -var h = 100500 -1; - -const i = 1, - j = 2; - -var k = 1, - l = [ - 1, 2, - 3, 4 - ], - m = 5; - -var n = function() { - return 7; -}, - o = 8; - -foo(bar, function() { - return 2; -}); - -switch (b) { -case "a": - 2; -default: - 3; -} - -var p = { - case: 'zzzz', - default: 'donkey', - tee: 'ornery' -}; - -var evens = [e for each (e in range(0, 21)) - if (ed % 2 == 0)]; - -var funs = [ - function() { - for (;;) { - } - }, - function(){}, -]; - -!b - !=b - !==b - -a++ -b += - c - -var re = /some value/ -str.match(re) - -baz(`http://foo.bar/${tee}`) - .qux(); - -`multiline string - contents - are kept - unchanged!` - -class A { - * x() { - return 1 - * a(2); - } - - *[Symbol.iterator]() { - yield "Foo"; - yield "Bar"; - } -} - -if (true) - 1 -else - 2 - -Foobar - .find() - .catch((err) => { - return 2; - }) - .then((num) => { - console.log(num); - }); - -var z = [ - ...iterableObj, - 4, - 5 -] - -var arr = [ - -1, 2, - -3, 4 + - -5 -]; - -// Regression test for bug#15582. -if (x > 72 && - y < 85) { // found - do_something(); -} - -// Test that chaining doesn't happen when js-chain-indent is nil. -let x = svg.mumble() - .zzz; - -// https://github.com/mooz/js2-mode/issues/405 -if (1) { - isSet - ? (isEmpty ? 2 : 3) - : 4 -} - -// Local Variables: -// indent-tabs-mode: nil -// js-indent-level: 2 -// End: diff --git a/test/manual/indent/latex-mode.tex b/test/manual/indent/latex-mode.tex index 55c8e7033bd..d314b98b483 100644 --- a/test/manual/indent/latex-mode.tex +++ b/test/manual/indent/latex-mode.tex @@ -8,4 +8,8 @@ To fix this, remove the \url{sn9c102.ko} from where it appears in \url{/lib/modules/$(uname -r)}, %bug#11953. and install the appropriate \url{gspca-modules} package. +Footnotes and emphasis shouldn't be indented \footnote{as can be seen here, +for example}, \emph{or there +as well}. + \end{document} diff --git a/test/manual/indent/less-css-mode.less b/test/manual/indent/less-css-mode.less index 36c037450cc..b40a2362e28 100644 --- a/test/manual/indent/less-css-mode.less +++ b/test/manual/indent/less-css-mode.less @@ -1,3 +1,13 @@ +@var-with-dashes: #428bca; +@var_with_underscores: 10px; +@_var-starting-with-underscore: none; + +body { + background: @var-with-dashes; + padding: @var_with_underscores; + display: @_var-starting-with-underscore; +} + .desktop-and-old-ie(@rules) { @media screen and (min-width: 1200) { @rules(); } html.lt-ie9 & { @rules(); } diff --git a/test/manual/indent/nxml.xml b/test/manual/indent/nxml.xml deleted file mode 100644 index 61b84f270b0..00000000000 --- a/test/manual/indent/nxml.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<spocosy version="1.0" responsetime="2011-03-15 13:53:12" exec="0.171"> - <!-- - <query-response requestid="" service="objectquery"> - <sport name="Soccer" enetSportCode="s" del="no" n="1" ut="2009-12-29 - 15:36:24" id="1"> - </sport> - </query-response> - --> -</spocosy> diff --git a/test/manual/indent/octave.m b/test/manual/indent/octave.m index 3052a6d3687..76cad09ad1e 100644 --- a/test/manual/indent/octave.m +++ b/test/manual/indent/octave.m @@ -14,6 +14,10 @@ function res = tcomp (fn) until x = ... y + spmd #bug#36703 + something + end + %% res = tcomp (fn) %% imports components and rearranges them. diff --git a/test/manual/indent/pascal.pas b/test/manual/indent/pascal.pas index 35e919f00b9..1efd9b83752 100644 --- a/test/manual/indent/pascal.pas +++ b/test/manual/indent/pascal.pas @@ -1,6 +1,6 @@ { GPC demo program for the CRT unit. -Copyright (C) 1999-2006, 2013-2017 Free Software Foundation, Inc. +Copyright (C) 1999-2006, 2013-2022 Free Software Foundation, Inc. Author: Frank Heckenbach <frank@pascal.gnu.de> diff --git a/test/manual/indent/perl.perl b/test/manual/indent/perl.perl index 06f32e7f090..b44593da028 100755 --- a/test/manual/indent/perl.perl +++ b/test/manual/indent/perl.perl @@ -5,6 +5,12 @@ sub add_funds($) { return 0; } +# qw(...) is a quoted list of words, so we can and should indent its content! +my @tutu = qw[ + tata + titi + ]; + my $hash = { foo => 'bar', format => 'some', @@ -75,3 +81,29 @@ return 'W' if #/^Not Available on Mobile/m; #W=Web only # A "y|abc|def|" shouldn't interfere when inside a string! $toto = " x \" string\""; $toto = " y \" string\""; # This is not the `y' operator! + + +# Tricky cases from Harald Jörg <haj@posteo.de> +$_ = "abcabc\n"; +s:abc:def:g; # FIXME: the initial s is fontified like a label, and indented + +s'def'ghi'g; # The middle ' should not end the quoting. +s"ghi"ijk"g; # The middle ' should not end the quoting. + +s#ijk#lmn#g; # This is a regular expression substitution. + +s #lmn#opq#g; # FIXME: this should be a comment starting with "#lmn" + /lmn/rst/g; # and this is the actual regular expression +print; # prints "rstrst\n" + +given ($num) { + when ($num>10) { + printf "number is greater than 10\n"; + } + when ($num<10) { + printf "number is less than 10\n"; + } + default { + printf "number is equal to 10\n"; + } +} diff --git a/test/manual/indent/ps-mode.ps b/test/manual/indent/ps-mode.ps deleted file mode 100644 index 4b4ee0f10cb..00000000000 --- a/test/manual/indent/ps-mode.ps +++ /dev/null @@ -1,14 +0,0 @@ -%!PS-2.0 - -<< 23 45 >> %dictionary -< 23 > %hex string -<~a>a%a~> %base85 string -(%)s -(sf\(g>a)sdg) - -/foo { - << - hello 2 - 3 - >> -} def diff --git a/test/manual/indent/ruby.rb b/test/manual/indent/ruby.rb deleted file mode 100644 index b038512b114..00000000000 --- a/test/manual/indent/ruby.rb +++ /dev/null @@ -1,477 +0,0 @@ -if something_wrong? # ruby-move-to-block-skips-heredoc - ActiveSupport::Deprecation.warn(<<-eowarn) - boo hoo - end - eowarn - foo - - foo(<<~squiggly) - end - squiggly -end - -def foo - %^bar^ -end - -# Percent literals. -b = %Q{This is a "string"} -c = %w!foo - bar - baz! -d = %(hello (nested) world) - -# Don't propertize percent literals inside strings. -"(%s, %s)" % [123, 456] - -"abc/#{ddf}ghi" -"abc\#{ddf}ghi" - -# Or inside comments. -x = # "tot %q/to"; = - y = 2 / 3 - -# Regexp after whitelisted method. -"abc".sub /b/, 'd' - -# Don't mis-match "sub" at the end of words. -a = asub / aslb + bsub / bslb; - -# Highlight the regexp after "if". -x = toto / foo if /do bar/ =~ "dobar" - -# Regexp options are highlighted. - -/foo/xi != %r{bar}mo.tee - -foo { /"tee/ - bar { |qux| /'fee"/ } # bug#20026 -} - -bar(class: XXX) do # ruby-indent-keyword-label - foo -end -bar - -foo = [1, # ruby-deep-indent - 2] - -foo = { # ruby-deep-indent-disabled - a: b -} - -foo = { a: b, - a1: b1 - } - -foo({ # bug#16118 - a: b, - c: d - }) - -bar = foo( - a, [ - 1, - ], - :qux => [ - 3 - ]) - -foo( - [ - { - a: b - }, - ], - { - c: d - } -) - -foo([{ - a: 2 - }, - { - b: 3 - }, - 4 - ]) - -foo = [ # ruby-deep-indent-disabled - 1 -] - -foo( # ruby-deep-indent-disabled - a -) - -# Multiline regexp. -/bars - tees # toots - nfoos/ - -def test1(arg) - puts "hello" -end - -def test2 (arg) - a = "apple" - - if a == 2 - puts "hello" - else - puts "there" - end - - if a == 2 then - puts "hello" - elsif a == 3 - puts "hello3" - elsif a == 3 then - puts "hello3" - else - puts "there" - end - - b = case a - when "a" - 6 - # Support for this syntax was removed in Ruby 1.9, so we - # probably don't need to handle it either. - # when "b" : - # 7 - # when "c" : 2 - when "d" then 4 - else 5 - end -end - -# Some Cucumber code: -Given /toto/ do - print "hello" -end - -# Bug#15208 -if something == :== - do_something - - return false unless method == :+ - x = y + z # Bug#16609 - - a = 1 ? 2 :( - 2 + 3 - ) -end - -# Bug#17097 -if x == :!= - something -end - -qux :+, - bar, - :[]=, - bar, - :a - -b = $: -c = ?? - -# Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html -d = 4 + 5 + # no '\' needed - 6 + 7 - -# Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html -e = 8 + 9 \ - + 10 # '\' needed - -foo = obj.bar { |m| tee(m) } + - obj.qux { |m| hum(m) } - -begin - foo -ensure - bar -end - -# Bug#15369 -MSG = 'Separate every 3 digits in the integer portion of a number' \ - 'with underscores(_).' - -class C - def foo - self.end - D.new.class - end - - def begin - end -end - -a = foo(j, k) - - bar_tee - -while a < b do # "do" is optional - foo -end - -desc "foo foo" \ - "bar bar" - -foo. - bar - -# https://github.com/rails/rails/blob/17f5d8e062909f1fcae25351834d8e89967b645e/activesupport/lib/active_support/time_with_zone.rb#L206 -foo # comment intended to confuse the tokenizer - .bar - -z = { - foo: { - a: "aaa", - b: "bbb" - } -} - -foo if - bar - -fail "stuff" \ - unless all_fine? - -if foo? - bar -end - -method arg1, # bug#15594 - method2 arg2, - arg3 - -method? arg1, - arg2 - -method! arg1, - arg2 - -method !arg1, - arg2 - -method [], - arg2 - -method :foo, - :bar - -method (a + b), - c, :d => :e, - f: g - -desc "abc", - defg - -it "is a method call with block" do |asd| - foo -end - -it("is too!") { - bar - .qux -} - -and_this_one(has) { |block, parameters| - tee -} - -if foo && - bar -end - -foo + - bar - -foo and - bar - -foo > bar && - tee < qux - -zux do - 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.bar - &.tee - -foo do - bar - .tee -end - -def bar - foo - .baz -end - -abc(foo - .bar, - tee - .qux) - -# http://stackoverflow.com/questions/17786563/emacs-ruby-mode-if-expressions-indentation -tee = if foo - bar - else - tee - end - -a = b { - c -} - -aa = bb do - cc -end - -foo :bar do - qux -end - -foo do |*args| - tee -end - -bar do |&block| - tee -end - -foo = [1, 2, 3].map do |i| - i + 1 -end - -bar.foo do - bar -end - -bar.foo(tee) do - bar -end - -bar.foo(tee) { - bar -} - -bar 1 do - foo 2 do - tee - end -end - -foo | - bar - -def qux - foo ||= begin - bar - tee - rescue - oomph - end -end - -private def foo - bar -end - -%^abc^ -ddd - -qux = foo.fee ? - bar : - tee - -zoo.keep.bar!( - {x: y, - z: t}) - -zoo - .lose( - q, p) - -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 -# distinguish from a variable reference inside a ternary operator. -foo(bar: - tee) - -foo(:bar => - tee) - -regions = foo( - OpenStruct.new(id: 0, name: "foo") => [ - 10 - ] -) - -{'a' => { - 'b' => 'c', - 'd' => %w(e f) - } -} - -# Bug#17050 - -return render json: { - errors: { base: [message] }, - copying: copying - }, - status: 400 - -top test( - some, - top, - test) - -foo bar, { - tee: qux - } diff --git a/test/manual/indent/scheme.scm b/test/manual/indent/scheme.scm index 84d0f6d8786..9053a8743e4 100644 --- a/test/manual/indent/scheme.scm +++ b/test/manual/indent/scheme.scm @@ -1,9 +1,23 @@ -#!/usr/bin/scheme is this a comment? - -;; This one is a comment -(a) -#| and this one as #|well|# as this! |# -(b) -(cons #;(this is a - comment) - head tail) +;; Testing sexp-comments + +(define a #;(hello) there) + +(define a #;1 there) + +(define a #;"asdf" there) + +(define a ;; #;(hello + there) + +(define a #;(hello + there) 2) + +(define a #;(hello + #;(world)) + and) + there) 2) + +(define a #;(hello + #;"asdf" (world + and) + there) 2) diff --git a/test/manual/indent/scss-mode.scss b/test/manual/indent/scss-mode.scss index a3dd41eeb47..2cd4adb8d55 100644 --- a/test/manual/indent/scss-mode.scss +++ b/test/manual/indent/scss-mode.scss @@ -1,5 +1,7 @@ // Comment! +@use "sass:math"; + nav { ul { margin: 0; /* More comment */ @@ -41,9 +43,13 @@ p.#{$name} var article[role="main"] { $toto: 500 !global; $var-with-default: 300 !default; + $var_with_underscores: #fff; + $_var-starting-with-underscore: none; float: left !important; - width: 600px / 888px * 100%; - height: 100px / 888px * 100%; + width: math.div(600px, 888px) * 100%; + height: math.div(100px, 888px) * 100%; + color: $var_with_underscores; + display: $_var-starting-with-underscore; } %placeholder { diff --git a/test/manual/indent/shell.sh b/test/manual/indent/shell.sh index dc184ea0d77..bd4a74f7054 100755 --- a/test/manual/indent/shell.sh +++ b/test/manual/indent/shell.sh @@ -6,6 +6,13 @@ setlock -n /tmp/getmail.lock && echo getmail isn\'t running toto=$(grep hello foo | wc) +myfun () { + for ((it=0; it<${limit}; ++it)) + { + echo "whatever $it" + } +} + # adsgsdg if foo; then diff --git a/test/manual/indent/tcl.tcl b/test/manual/indent/tcl.tcl new file mode 100644 index 00000000000..f055be19663 --- /dev/null +++ b/test/manual/indent/tcl.tcl @@ -0,0 +1,26 @@ +# Some sample code that tries to exercise the font-lock +# of various forms of writing strings. + +puts "hello}"; # Top-level strings can contain unescaped closing braces! + +puts a"b; # Non-delimited strings can contain quotes! +puts a""b; # Even several of them! + +proc foo1 {} { + puts "hello"; # Normal case! + puts "hello\}; # This will signal an error when `foo1` is called! +} + +proc foo2 {} { + puts "hello; # This will also signal an error when `foo2` is called! +} + +proc foo3 {} { + puts a"b; # This will not signal an error! + puts a""b"; # And that won't either! + puts "a""b"; # But this will! +} + +# FIXME: The [..] interpolation within "..." strings is not properly +# handled by the current `syntax-propertize-function`! +set a "Testing: [split "192.168.1.1/24" "/"] address"; |