# 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
}}
