File: line-spanning.t

package info (click to toggle)
nqp 2024.09%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,972 kB
  • sloc: java: 28,087; perl: 3,479; ansic: 451; makefile: 202; javascript: 68; sh: 1
file content (67 lines) | stat: -rw-r--r-- 1,068 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
puts "1..13"

a=[10,
   20]

puts "#{a[1]? 'ok' : 'nok'} 1 - array spanning lines"

=begin
This is a multi-line comment and can span as many lines as you
like. But =begin and =end should appear at the start of line only.
#{exit 42}
=end

b = [30 # some comments
,
    40

]
puts "#{b[1]? 'ok' : 'nok'} 2 - array spanning lines"

h = {"a" => 10,
     "b"
 , 20
, "c" => 30
}
puts "#{h<c> == 30? 'ok' : 'nok'} 3 - hash spanning lines"

def tricky(k,
   n, desc)
    puts "#{k} #{n} - multi-line signatures #{desc}"
end

tricky('ok',4,"simple call")
tricky(
      "ok",

      5,

      "multi-line call"

     )

puts \
  "ok 6 - \\ line continuation"

heredoc = <<EOF
ok 7 - heredoc line 1
ok 8 - heredoc line 2
EOF
puts heredoc

heredoc2 = <<'EOF'
ok 9 - heredoc2
EOF
puts heredoc2

tst = 10

theredoc = <<"THE_END"
ok #{tst} - heredoc interpolating line 1
ok #{tst += 1} - heredoc interpolating line 2
THE_END
puts theredoc

print "ok 12 - multi-line string line 1
ok 13 - multi-line string line 2
"