!******************************************************************************!
! Tests passing NXM & XM style args to a Macro Command
!
! Note: BBB should have the space separated expected results for the
!       other args passed in in table form
!
! @issue:   NXM-4063 Macros not handling variable number of arguments
! @author:  Jeanette McCall
! @since:   NeXtMidas 4.1.4
!******************************************************************************!
startmacro cs:AAA[a1] cs:BBB[b2] cs:CCC[c3] cs:DDD[d4] cs:EEE[e5] cs:FFF[f6]

  table actTable create {AAA="^AAA",CCC="^CCC",DDD="^DDD",EEE="^EEE",FFF="^FFF"}
  table expTable create "^BBB"

  invoke match nxm.sys.test.TestUtil.tablesEqual(expTable,actTable)
  assert/text="^reg.main.name: Macro Args Passed in correctly" match isTrue
  if match isFalse
    res actTable
  endif

endmacro

!******************************************************************************!
! Main process message for this macro. Should be right after the ENDMACRO.
!******************************************************************************!
procedure processMessage m:msg
  say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
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