aboutsummaryrefslogtreecommitdiff
path: root/tests/variable/testscript
blob: d3d9302a042e819249184b6f5ab15db9d1d18c23 (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
}