use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseRecognizesEntryWithNewlines.
@Test
public void parseRecognizesEntryWithNewlines() throws IOException {
ParserResult result = parser.parse(new StringReader("@article\n{\ntest,author={Ed von Test}}"));
Collection<BibEntry> c = result.getDatabase().getEntries();
assertEquals(1, c.size());
BibEntry e = c.iterator().next();
assertEquals("article", e.getType());
assertEquals(Optional.of("test"), e.getCiteKeyOptional());
assertEquals(2, e.getFieldNames().size());
assertEquals(Optional.of("Ed von Test"), e.getField("author"));
}
use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseRecognizesMonthFieldsWithFollowingComma.
/**
* Test for SF Bug #1283
*/
@Test
public void parseRecognizesMonthFieldsWithFollowingComma() throws IOException {
ParserResult result = parser.parse(new StringReader("@article{test,author={Ed von Test},month={8,}},"));
Collection<BibEntry> c = result.getDatabase().getEntries();
assertEquals(1, c.size());
BibEntry e = c.iterator().next();
assertEquals("article", e.getType());
assertEquals(Optional.of("test"), e.getCiteKeyOptional());
assertEquals(3, e.getFieldNames().size());
assertEquals(Optional.of("Ed von Test"), e.getField("author"));
assertEquals(Optional.of("8,"), e.getField("month"));
}
use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseConvertsTabToSpace.
@Test
public void parseConvertsTabToSpace() throws IOException {
ParserResult result = parser.parse(new StringReader("@article{test,a = {a\tb}}"));
Collection<BibEntry> c = result.getDatabase().getEntries();
BibEntry e = c.iterator().next();
assertEquals(Optional.of("a b"), e.getField("a"));
}
use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseAddsEscapedOpenBracketToFieldValue.
/**
* Test for SF bug 482
*/
@Test
public void parseAddsEscapedOpenBracketToFieldValue() throws IOException {
ParserResult result = parser.parse(new StringReader("@article{test,review={escaped \\{ bracket}}"));
assertFalse(result.hasWarnings());
Collection<BibEntry> c = result.getDatabase().getEntries();
assertEquals(1, c.size());
BibEntry e = c.iterator().next();
assertEquals("article", e.getType());
assertEquals(Optional.of("test"), e.getCiteKeyOptional());
assertEquals(Optional.of("escaped \\{ bracket"), e.getField("review"));
}
use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseIgnoresText.
@Test
public void parseIgnoresText() throws IOException {
ParserResult result = parser.parse(new StringReader("comment{some text and \\latex"));
assertEquals(0, result.getDatabase().getEntries().size());
}
Aggregations