! Tests the UPDATE commands behavior with default arguments. Currently an empty
! default value before an actual default value will be replaced out on UPDATE.
!
! @bug     1496 does not properly handle empty default arguments
! @bug     2136 interactive update does not allow multiple command support entry
! @author  Jim Roush
! @since   NeXtMidas 2.7.0
!******************************************************************************!
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

 
  if ^{env.NMROOT} EQS "classpath:" then
    info "SKIPPING ^REG.MAIN.NAME since writing to files inside a jar is not possible."
  else
    if baseline then
      %test_update_abbrev
    endif
    if interAct then
      res inst "A test command named 'GARBAGE' has been added to a test option tree called MYTESTOPT1. &
                The command has two default arguments the first of which is blank.\n\n&
                (1) At the command prompt type 'UPDATE GARB' and hit the ENTER key &
                several times to get to the argument defaults.\n\n&
                (2) The first default should be blank. Enter 'IN=XXX' for a default.\n\n&
                (3) The second default should be 'AUX=3'. Push the UP ARROW. No text &
                should display. Hit ENTER to continue. There should be no errors.\n\n&
                (4) Type 'DEF GARB' and hit ENTER. You should see the defaults you entered."

      pipe on
        panel/msgid=MAIN/setup/controls=gc
        gcontrol label  macro   "MACRO"
        gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
        set gc.main.itemColors {PASS=GREEN,FAIL=RED}
        gcontrol text idtext "INSTRUCTIONS" "^inst" 24 30 /title
        shellgui/id=idshellgui

        option MYTESTOPT1 rootOptDir
        path add MYTESTOPT1
        ! for testing Bug 2136 (interactive update does not support multiple command support), set support="MP"
        update GARB*AGE opt=MYTESTOPT1 support="MP" nargs=2 def1="" def2="AUX=3"

      pipe off

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

      if interAct AND baseline then
        %test_update_use_first_path_entry
      endif
    endif

    %test_update_initialization
  endif
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
