aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/build/script/parser+line.test.testscript
blob: 1b392655bdd155656b6277beb196f202d109ce8d (plain)
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
68
69
70
71
72
73
74
75
76
77
78
# file      : libbuild2/build/script/parser+line.test.testscript
# license   : MIT; see accompanying LICENSE file

test.options += -d

: command
:
$* <<EOF >>EOF
  foo >| 2>- &a &?b
  foo >=c 2>~/error:.*/ &!c
  foo >>:/~%EOS%
  %.*
  abc
  %xyz.*%
  EOS
  EOF

: if-else
:
$* <<EOF >>EOF
  if foo
    bar
  elif fox
    if fix
      baz
    end
    biz
  end
  if! foo
    bar
  elif! fox
    baz
  end
  EOF

: quoting
:
$* <<EOI >>EOO
  foo 'bar' "baz" '' ""
  "$foo"
  "foo$bar"
  "fo"o
  "foo"\"
  "foo\\"
  "foo\"<"
  fo\"o
  fo\\o
  fo\<o
  "fo<o"
  'fo\"o'
  f"oo" "ba"r
  f"oo" 'ba'r
  "fo"'o'
  'foo b"ar baz'
  EOI
  foo 'bar' "baz" '' ""
  "$foo"
  "foo$bar"
  "foo"
  "foo\""
  "foo\\"
  "foo\"<"
  fo\"o
  fo\\o
  fo\<o
  "fo<o"
  'fo\"o'
  "foo bar"
  "foo" 'bar'
  "foo"
  'foo b"ar baz'
  EOO

: no-newline
:
$* <:'foo' 2>>EOE != 0
  buildfile:11:4: error: expected newline instead of <end of file>
  EOE