! Tests macro comments parsing and execution
!
! Author:  Jay Hallam
! Since:   NeXtMidas 2.3.2
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)
  
  res x "a string" ! This is an executable line
  assert/text="^reg.main.name:  Trailing comment BANG " x EQS "a string"
  
  /* res x "Single line comment" */
  assert/text="^reg.main.name: /* Single line comment */" x EQS "a string"
     /* Inside comment line 1
        Inside comment line 2
        Inside comment line 3
     */
     res y 999
     /* Inside comment with STARSLASH
        inside comment normal
        res y -777
     */
  assert/text="^reg.main.name: Multi-line comment" y EQ 999
  
  res z "trailing comment" /*Trailing comment*/
  assert/text="^reg.main.name: Trailing comment /**/" z EQS "trailing comment"
  
  
  invoke GcontrolExists reg.shell.M.dictionary.isDictionaryEntry(GCONTROL)
  if interAct AND GcontrolExists then
  
    set instructions "You should see a String result FOO listed with a slash-star in it.\n\n&
                      You should also see three lines with 'hello world' with a star-slash, &
                      a slash-star, or both.\n\nYou should also see two more lines of text below this line\n\n&
                      /* 'Here thar be text!' */ \n\n\u002F\u002A 'Yar, and some more! \u002A\u002F "

    pipe on
      panel/msgid=MAIN/setup/controls=gc
      gcontrol label macro "Test MACRO"
      gcontrol menu  main "Exit with Status =" "PASS,FAIL" TABLE={ItemColors={PASS="GREEN",FAIL="RED"}} /tleft

      gcontrol text  idtext "Instructions" instructions 24 16 /title
      
      shellgui/id=idshellgui/attach
      
      res foo "some/sub/dir/*.so"
      res foo 
      
      SAY "You should see 'hello world' after a slash-star: /* hello world "  
      SAY "You should see 'hello world' before a star-slash:  hello world */ " 
      SAY "You should see 'hello world' between a slash-star and a star-slash: /* hello world */ "  
      
    pipe off
  
  endif
  
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

