Skip to content

Commit

Permalink
SAS7BDAT html tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagravarr committed May 3, 2018
1 parent 79f313d commit 90720ae
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ public void parse(InputStream stream, ContentHandler handler,
// Do the column headings
xhtml.startElement("tr");
for (Column c : sas.getColumns()) {
String label = c.getLabel();
if (label == null || label.isEmpty()) label = c.getName();

xhtml.startElement("th", "title", c.getName());
xhtml.characters(c.getLabel());
xhtml.characters(label);
xhtml.endElement("th");
}
xhtml.endElement("tr");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,22 @@ public void testMultiColumns() throws Exception {
assertContains("\t08Feb1904\t", content);
}

// TODO HTML contents unit test
@Test
public void testHTML() throws Exception {
XMLResult result = getXML("testSAS.sas7bdat");
String xml = result.xml;

// Check the title came through
assertContains("<h1>TESTING</h1>", xml);
// Check the headings
assertContains("<th title=\"recnum\">recnum</th>", xml);
assertContains("<th title=\"label\">label</th>", xml);
// Check some rows
assertContains("<td>3</td>", xml);
assertContains("<td>This is row", xml);
assertContains("10</td>", xml);
}

// TODO Column names vs labels, with a different test file
// TODO Columnar consistency test
}

0 comments on commit 90720ae

Please sign in to comment.