# file      : tests/buildtab/testscript
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

: valid
:
: Roundtrip buildtab.
:
{
  : all-fileds-combinations
  :
  $* <<EOF >>EOF
  windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0
  windows*-vc_14* windows-vc_14-32-debug i686-microsoft-win32-msvc14.0 config.cc.coptions=/Z7 config.cc.loptions=/DEBUG ~"warning C4\d{3}: "
  EOF

  : empty-lines
  :
  $* <<EOI >>EOO

  windows*-vc_14* windows-vc_14-32-debug i686-microsoft-win32-msvc14.0
   # abc
  EOI
  windows*-vc_14* windows-vc_14-32-debug i686-microsoft-win32-msvc14.0
  EOO
}

: parse-errors
:
{
  : no-name
  :
  $* <<EOI 2>>EOE == 1
  windows*-vc_14*
  EOI
  cin:1:16: error: no configuration name found
  EOE

  : no-target
  :
  $* <<EOI 2>>EOE == 1
  windows*-vc_14* windows-vc_14-32
  EOI
  cin:1:33: error: no target found
  EOE

  : invalid-target
  :
  $* <<EOI 2>>EOE == 1
  windows*-vc_14* windows-vc_14-32 microsoft
  EOI
  cin:1:34: error: missing cpu
  EOE

  : invalid-var
  :
  {
    : unquoted
    :
    $* <<EOI 2>>EOE == 1
    windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0 config.cc.coptions="/Z7
    EOI
    cin:1:87: error: unterminated quoted string
    EOE

    : no-value
    :
    $* <<EOI 2>>EOE == 1
    windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0 config.cc.coptions
    EOI
    cin:1:64: error: no variable value
    EOE
  }

  : dup-config-name
  :
  $* <<EOI 2>'cin:2:17: error: duplicate configuration name' == 1
  windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0
  windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0
  EOI
}