public void testConvertRows() { tester.setProperties(props_escbsoptin); String input = "|| Heading 1 || Heading 2\n" + "| r1c1 | r1c2 \\\\ r1c2\n" + "| r2c1 | r2c2\n"; String expected = "|| Heading 1 || Heading 2 ||\n" + "| r1c1 | r1c2 r1c2 |\n" + "| r2c1 | r2c2 |\n"; String actual = tester.convertRows(input); assertNotNull(actual); assertEquals(expected, actual); }
public void testConvertHeaders() { String input = "|| Heading 1 || Heading 2\n"; String expected = "|| Heading 1 || Heading 2 ||\n"; String actual = tester.convertHeaders(input); assertNotNull(actual); assertEquals(expected, actual); input = "| r1c1 | r1c2 \\\\ r1c2\n"; expected = input; actual = tester.convertHeaders(input); assertNotNull(actual); assertEquals(expected, actual); }
public void testRemoveBackslashes() { String input = "A \\\\ B"; String expected = "A B"; String actual = tester.removeBackslashes(input); assertNotNull(actual); assertEquals(expected, actual); }
public void testEscapeDash() { String input = "| - |hyphen, match a range of chars "; String expected = "| \\- |hyphen, match a range of chars |\n"; String actual = tester.convertTables(input); assertNotNull(actual); assertEquals(expected, actual); }
public void testEscapePipe() { String input = "|~| |pipe: {{a~|b}} matches a or b "; String expected = "|\\| |pipe: {{a\\|b}} matches a or b |\n"; String actual = tester.convertTables(input); assertNotNull(actual); assertEquals(expected, actual); }
public void testEscapeStar() { // one line ends in newline String input = "|* |zero or more times |? |zero or one time\n"; String expected = "| \\* | zero or more times | ? |zero or one time |\n"; String actual = tester.convertTables(input); assertEquals(expected, actual); // one line no newline input = "|* |zero or more times |? |zero or one time"; expected = "| \\* | zero or more times | ? |zero or one time |\n"; actual = tester.convertTables(input); assertEquals(expected, actual); // before and after table text input = "Before\n" + "|* |zero or more times |? |zero or one time\n" + "After"; expected = "Before\n" + "| \\* | zero or more times | ? |zero or one time |\n" + "After"; actual = tester.convertTables(input); assertNotNull(actual); assertEquals(expected, actual); }
public void testProblemSample() { String input = "|| ~~~Date~~~ || User || Action\n" + "| 2010-09-16 | Marco | *Migration Spain --> Rural* \\\\- 16:00 es.migrated.phase1=false set on production \\\\Database restore point (if needed) / last committed Spain (ES) transaction = *2010-09-16-16.30.00.000000* \\\\ Last logfile needed: *S0018824.LOG*\n" + ""; String expected = "|| ~~~Date~~~ || User || Action ||\n" + "| 2010-09-16 | Marco | *Migration Spain --> Rural* \\\\- 16:00 es.migrated.phase1=false set on production \\\\Database restore point (if needed) / last committed Spain (ES) transaction = *2010-09-16-16.30.00.000000* \\\\ Last logfile needed: *S0018824.LOG* |\n" + ""; String actual = tester.convertTables(input); assertNotNull(actual); assertEquals(expected, actual); }
public void testConvertRowsKeepNewline() { String input = "| a | b \n"; String expected = "| a | b |\n"; String actual = tester.convertRows(input); assertEquals(expected, actual); }