!******************************************************************************!
! Test for consistent handling of whitespace within a table
!
! @bug      NXM-3143 Inconsistent handling of whitespace within a table
! @since    NextMidas 3.8.1
! @author:  Jeanette McCall
!
! CAUTION: editing this file in Eclipse may result in loss of TABS for tab test
!
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE  ! for defects or more obscure test case(s)

  table ,, GETDEFAULTFlags defFlags

  !****************************************************************************!
  ! Test with NEW consistent behavior for whitespace
  !****************************************************************************!
  table ,, SETDEFAULTFlags "-DisableConsistentHandlingOfWhiteSpace"

  ! This needs to be in a different macro because macros are fully evaluated before executing. Therefore, the test will not pass when run in this macro.
  %test_table_whitespace_consistent

  !****************************************************************************!
  ! Test with OLD inconsistent behavior for whitespace
  !****************************************************************************!
  table ,, SETDEFAULTFlags "+DisableConsistentHandlingOfWhiteSpace"
  %test_table_whitespace_inconsistent

  !****************************************************************************!
  !Revert the setting back
  !****************************************************************************!

  table ,, SETDEFAULTFlags defFlags


endmacro

!******************************************************************************!
! Main process message for this macro. Should be right after the ENDMACRO.
!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop
  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

!******************************************************************************!
! If an unexpected exception is caught, mark test as failed, unless it is expected
!******************************************************************************!
procedure processException m:emsg
  if expectedException REXISTS then
    assert/text="^reg.main.name: Expected ERROR starts with: ^{expectedException}" expectedException EQSS emsg.data.message
    remove expectedException
  else
    assert/text="^reg.main.name: Caught unexpected exception ^{emsg.data}" "FALSE" isTrue
    if "Trace" SUBS ENV.DEBUG then invoke ,, emsg.data.printStackTrace()
  endif
return