aboutsummaryrefslogtreecommitdiff
path: root/tests/variable/testscript
blob: 3269a3767dfffecc61e4f6f8290f41e1f63bb60f (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
# file      : tests/variable/testscript
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

test.options += -u

: valid
:
{
  $* <<EOI >>EOO
  config.cc.coptions="-O3 -stdlib='libc++'"
  ab'c="x y"'
  var=xy
  var=
  EOI
  config.cc.coptions=-O3 -stdlib='libc++'
  abc="x y"
  var=xy
  var=
  EOO
}

: invalid
:
{
  : expected-assignment
  :
  $* <'v"a r=abc"' 2>'1:4: error: expected variable assignment' == 1

  : unterminated-quoted-string
  :
  $* <'var="a b' 2>'1:9: error: unterminated quoted string' == 1

  : no-value
  :
  $* <'var' 2>'1:4: error: no variable value' == 1
}

: unquoting
:
{
  : single
  :
  $* <"var='a \" b'" >'var=a " b'

  : double
  :
  $* <'var="a '"'"' b"' >"var=a ' b"

  : mixed
  :
  $* <<EOI >'var=a bc e'
  var='a b'"c e"
  EOI
}