!******************************************************************************!
! Tests that the use of the caret will reference previously set results in the
! table. Also tests orignal functionality ignoring the caret.
!
! @bug      NXM-3234 Jeff changes
! @since    NextMidas 3.9.0
! @author:  Kevin Esterheld
!
!
!******************************************************************************!
startmacro

  ! All of these tests go through Parser.clean() and Table.fromBytes(String); 
  ! Table without whitespace for expected
  set tblexp {KEY1="FIRST VALUE",KEY2="SECOND",KEY3="SECOND",KEY4="FIRST VALUE"}
 
  !This scenario of having a space before a comma, the Parser.Clean fixes that case.
  ! Extra SPACEs before , ignored
  set tblwithcaret { KEY1 = "FIRST VALUE" , KEY2 =  "SECOND", KEY3 = ^KEY2 , KEY4 = ^KEY1}
  table tblwithcaret equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table with carets does reference previous kv pair" tables_are_equal isTrue
  env get iooptions origOptions
  env set iooptions +DisableResultUsageWithCaretInTable

  set tblexp { KEY1 = "FIRST VALUE" , KEY2 =  "SECOND", KEY3 = "^KEY2" , KEY4 = "^KEY1"}

  set tblwithoutcaretusage { KEY1 = "FIRST VALUE" , KEY2 =  "SECOND", KEY3 = ^KEY2 , KEY4 = ^KEY1}
  assert/text="^reg.main.name: Table with carets does not reference previous kv pair" tables_are_equal isTrue
  env set iooptions origOptions
endmacro
