aboutsummaryrefslogtreecommitdiff
path: root/tests/string-parser/testscript
blob: 05c2807d8522f59711578e3a2a4020eacc6173a9 (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
# file      : tests/string-parser/testscript
# license   : MIT; see accompanying LICENSE file

: valid
:
{
  test.options += -l
  sp=' ' # For line-terminating spaces.

  : quoted
  :
  {
    $* -p <<"EOI" >>EOO
    abc  "d 'ef " 'x  "y z'$sp
    EOI
    0:abc
    5:"d 'ef "
    14:'x  "y z'
    EOO
  }

  : unquoted
  :
  {
    $* -u <<"EOI" >>"EOO"
    abc  "d 'ef " 'x  "y z'$sp
    EOI
    abc
    d 'ef$sp
    x  "y z
    EOO
  }

  : comments
  :
  {
    $* -c <<EOI >>EOO
    # Comment 1
    #
    abc #xyz

      # Comment 2
      #
      abc#

    "# not a comment 3" #not-a-comment4

    "abc
    # not a comment 5
    "
    # Comment 6
    EOI
    abc
    #xyz
    abc#
    "# not a comment 3"
    #not-a-comment4
    "abc
    # not a comment 5
    "
    EOO
  }
}

: invalid
:
{
  : unterm-quoting
  :
  $* <'ab"c' 2>'4: unterminated quoted string' == 1
}