!******************************************************************************!
! Test for consistent handling of whitespace within a table
! This will test that the table is using the fix for whitespace
!
! @bug      NXM-3143 Inconsistent handling of whitespace within a table
! @since    NextMidas 3.8.1
! @author:  Jeanette McCall
!
! CAUTION: editing this file in Eclipse may result in loss of TABS for tab test
!
!******************************************************************************!
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=THIRD,KEY4=4}

  ! Extra SPACEs around equals ignored
  set tbl1ws { KEY1 = "FIRST VALUE", KEY2 =  "SECOND", KEY3 = THIRD, KEY4 = 4}
  table tbl1ws equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table with SPACEs after equals ignored " tables_are_equal isTrue
  
  ! Wrap ignored
  set tbl2ws { KEY1 = &
  "FIRST VALUE", KEY2 =  &
  "SECOND", KEY3 = THIRD, KEY4 = &
  4}
  table tbl2ws equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table with newline after equals ignored" tables_are_equal isTrue

  ! Tabs ignored - BE CAREFUL EDITING in Eclipse - may have setting that turns tabs into spaces - these are tabs!
  set tbl3ws {	KEY1	=	"FIRST VALUE",	KEY2 =	"SECOND",	KEY3	=	THIRD,	KEY4	=	4}
  table tbl3ws equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table with TABs after equals ignored" tables_are_equal isTrue


  !This scenario of having a space before a comma, the Parser.Clean fixes that case.
  ! Extra SPACEs before , ignored
  set tbl4ws { KEY1 = "FIRST VALUE" , KEY2 =  "SECOND", KEY3 = THIRD , KEY4 = 4}
  table tbl4ws equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table with SPACEs after equals ignored" tables_are_equal isTrue

  table tbl5ws create { KEY1 = "FIRST VALUE" , KEY2 =  "SECOND", KEY3 = THIRD , KEY4 = 4}
  table tbl5ws equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table with SPACEs after equals ignored" tables_are_equal isTrue

  table tbl6ws create {	KEY1	=	"FIRST VALUE",	KEY2 =	"SECOND",	KEY3	=	THIRD,	KEY4	=	4}
  table tbl6ws equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table with TABs after equals ignored" tables_are_equal isTrue

  table tbl7ws create { KEY1 = "FIRST VALUE", KEY2 =  "SECOND", KEY3 = THIRD, KEY4 = 4}
  table tbl7ws equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table with SPACEs after equals ignored" tables_are_equal isTrue

  table tbl8ws create { KEY1 = &
  "FIRST VALUE", KEY2 =  &
  "SECOND", KEY3 = THIRD, KEY4 = &
  4}
  table tbl8ws equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table with newline after equals ignored " tables_are_equal isTrue
  

  !Test the same tables loaded from a file.
  TABLE tblFile LOAD "nxm.sys.test.test_table_whitespace.tbl"
  table tblFile.tbl1wsfile equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table (file) with SPACEs after equals ignored" tables_are_equal isTrue
  table tblFile.tbl2wsfile equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table (file) with newline after equals ignored" tables_are_equal isTrue
  table tblFile.tbl3wsfile equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table (file) with TABs after equals ignored" tables_are_equal isTrue
  table tblFile.tbl4wsfile equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table (file) with SPACEs after equals ignored" tables_are_equal isTrue


  !Test the same tables loaded from a file. Using the Create method of table.
  TABLE tblFile2 create "nxm.sys.test.test_table_whitespace.tbl"
  table tblFile2.tbl1wsfile equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table (file) with SPACEs after equals ignored" tables_are_equal isTrue
  table tblFile2.tbl2wsfile equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table (file) with newline after equals ignored" tables_are_equal isTrue
  table tblFile2.tbl3wsfile equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table (file) with TABs after equals ignored" tables_are_equal isTrue
  table tblFile2.tbl4wsfile equals tblexp tables_are_equal
  assert/text="^reg.main.name: Table (file) with SPACEs after equals ignored" tables_are_equal isTrue

 
endmacro
