/** Tests the internal parser (Option {@link MainOptions#INTPARSE}). */ @Test public void intParse() { set(MainOptions.CHOP, false); final StringBuilder sb = new StringBuilder(); final String[] docs = { "<x/>", " <x/> ", "<x></x>", "<x>A</x>", "<x><x>", "<x/><x/>", "<x></x><x/>", "<x>", "</x>", "<x></x></x>", "x<x>", "<x>x", "<x><![CDATA[ ]]></x>", }; for (final String doc : docs) { // parse document with default parser (expected to yield correct result) set(MainOptions.INTPARSE, false); boolean def = true; try { new CreateDB(NAME, doc).execute(context); } catch (final BaseXException ex) { def = false; } // parse document with internal parser set(MainOptions.INTPARSE, true); boolean cust = true; try { new CreateDB(NAME, doc).execute(context); } catch (final BaseXException ex) { cust = false; } // compare results if (def != cust) { sb.append('\n').append(def ? "- not accepted: " : "- not rejected: ").append(doc); } } // list all errors if (sb.length() != 0) fail(sb.toString()); set(MainOptions.MAINMEM, false); }