! Tests the UPDATE commands initialization by testing in a loop
!
! @bug     NXM-3619 Intrinsic Initialization
! @author  Jeanette McCall
! @since   NeXtMidas 3.9.4
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  ! Points to test option trees
  FILE NAME rootOptDir (^{env.nmroot},nxm,sys,test,nmopts) "" ""
  set oldPath opt.path

  option MYTESTOPT1 rootOptDir
  path add MYTESTOPT1

  res default1 "HELLO"
  res default2 "HI"
  res default3 "GOODBYE"
  res support1 "MP"
  res support2 "MI"
  res support3 "MP"
  res midas reg.shell.M

  DO l:count 1 3 1
    calc l:index count 1 -
    update GARB*AGE opt=MYTESTOPT1 support=support^count nargs=2 def1=default^count def2="AUX=^count"
    invoke l:cmdidx midas.dictionary.findMatch(GARBAGE)
    invoke cmd midas.dictionary.getEntry(cmdidx)
    assert/text="^reg.main.name: Test for UPDATE initialization" cmd.def1 eqss ^{default^count}
  ENDDO

  UPDATE/delete name=GARBAGE opt=MYTESTOPT1
  PATH SET ^oldPath
  OPTION/DELETE MYTESTOPT1

endmacro

!******************************************************************************!
procedure processMessage m:msg
  !say "msg.name ^msg.name, data ^msg.data"
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: Test for UPDATE default args" msg.data eqss "PASS"
    pipe stop
  else
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return
