! Tests that the UPDATE command defaults to the first option tree in PATH
! for a new command
!
! @bug     1764
! @author  Neon Ngo
! @since   NeXtMidas 2.7.1
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  if interAct then
    res currentPath OPT.PATH
    sedit currentPath firstPathEntry ELEMENT 1 ","
    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 label instructions "INSTRUCTIONS"
      gcontrol panel tdisp
      textdisplay/id=tdisp text=""

      message send tdisp,,"APPENDL",,"First option tree in PATH should be the default"
      message send tdisp,,"APPENDL",,"option tree when adding a new command."
      message send tdisp,,"APPENDL",,"Run (type) the following in the SHELL on right:"
      message send tdisp,,"APPENDL",," "
      message send tdisp,,"APPENDL",," update newcommand <ENTER>"
      message send tdisp,,"APPENDL",," "
      message send tdisp,,"APPENDL",,"Make sure to use a command that is NOT in the "
      message send tdisp,,"APPENDL",,"dictionary. The default option tree should be: [^{firstPathEntry}]"

      shellgui/id=idshellgui
    pipe off
  endif
endmacro

procedure processMessage m:msg
  !say "Got ^msg"
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: Tests for UPDATE" 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
