[Commonmark] Enhance additional tests for inlines
diff --git a/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/AbstractSourceSpanTest.java b/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/AbstractSourceSpanTest.java
index 5406190..92c7653 100644
--- a/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/AbstractSourceSpanTest.java
+++ b/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/AbstractSourceSpanTest.java
@@ -20,6 +20,7 @@
 import static org.junit.Assert.assertNull;
 
 import java.io.StringWriter;
+import java.util.Arrays;
 import java.util.List;
 
 import org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder;
@@ -32,6 +33,7 @@
 import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.CommonmarkLocator;
 import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.Cursor;
 import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.Line;
+import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.LineSequence;
 import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.ProcessingContext;
 import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.TextSegment;
 import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.spec.SimplifiedHtmlDocumentBuilder;
@@ -41,6 +43,27 @@
 abstract class AbstractSourceSpanTest {
 	
 	
+	public static void assertParse(final String content, final InlineParser parser,
+			final Inline... expectedInlines) {
+		final List<Inline> expected= Arrays.asList(expectedInlines);
+		final List<Inline> actual= parser.parse(CommonmarkAsserts.newContext(),
+				new TextSegment(LineSequence.create(content)), true );
+		for (int x= 0; x < expected.size() && x < actual.size(); ++x) {
+			assertEquivalent(x, expected.get(x), actual.get(x));
+		}
+		assertEquals(expected, actual);
+	}
+	
+	public static void assertEquivalent(final int index, final Inline expected, final Inline actual) {
+		final String message= String.format("inlines[%1$s]", index);
+		assertEquals(message + ".type", expected.getClass(), actual.getClass());
+		assertEquals(message + ".startOffset", expected.getStartOffset(), actual.getStartOffset());
+		assertEquals(message + ".length", expected.getLength(), actual.getLength());
+		assertEquals(message + ".cursorLength", expected.getCursorLength(), actual.getCursorLength());
+		assertEquals(message, expected, actual);
+	}
+	
+	
 	protected @Nullable SourceSpan span;
 	
 	
diff --git a/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/BackslashEscapeSpanTest.java b/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/BackslashEscapeSpanTest.java
index 6ff7561..eb0b090 100644
--- a/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/BackslashEscapeSpanTest.java
+++ b/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/BackslashEscapeSpanTest.java
@@ -34,6 +34,7 @@
 		assertNoInline(Cursors.createCursor("\\"));
 		assertNoInline(Cursors.createCursor("\\a"));
 		assertEscapedCharacter('\\', 0, 2, Cursors.createCursor("\\\\"));
+		assertEscapedCharacter('\\', 0, 2, Cursors.createCursor("\\\\\\"));
 		assertEscapedCharacter('*', 0, 2, Cursors.createCursor("\\*"));
 		assertEscapedCharacter('_', 0, 2, Cursors.createCursor("\\_*"));
 	}
diff --git a/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/InlineParserTest.java b/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/InlineParserTest.java
index 4ac595d..99a58fc 100644
--- a/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/InlineParserTest.java
+++ b/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/InlineParserTest.java
@@ -14,28 +14,20 @@
 
 package org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.inlines;
 
+import static org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.inlines.AbstractSourceSpanTest.assertParse;
 import static org.junit.Assert.assertEquals;
 
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.Rule;
 import org.junit.Test;
-import org.junit.rules.ExpectedException;
 
 import org.eclipse.statet.jcommons.collections.ImCollections;
 
 import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.CommonmarkAsserts;
 import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.Line;
-import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.LineSequence;
 import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.TextSegment;
 
 
 public class InlineParserTest {
 	
-	@Rule
-	public final ExpectedException thrown= ExpectedException.none();
-	
 	
 	private final Line line= new Line(0, 1, 0, "test", "\n");
 	
@@ -44,20 +36,19 @@
 	}
 	
 	
-	@Test
+	@Test (expected= NullPointerException.class)
 	public void requiresSpans() {
-		this.thrown.expect(NullPointerException.class);
 		new InlineParser(null);
 	}
 	
 	@Test
 	public void parse() {
-		assertParse("");
-		assertParse("one\ntwo",
+		assertParse("", createInlines());
+		assertParse("one\ntwo", createInlines(),
 				new Characters(this.line, 0, 3, 3, "one"),
 				new SoftLineBreak(this.line, 3, 1, 1),
 				new Characters(this.line, 4, 3, 3, "two") );
-		assertParse("one\ntwo three",
+		assertParse("one\ntwo three", createInlines(),
 				new Characters(this.line, 0, 3, 3, "one"),
 				new SoftLineBreak(this.line, 3, 1, 1),
 				new Characters(this.line, 4, 9, 9, "two three") );
@@ -72,24 +63,6 @@
 		assertEquals("one two three", stringContent);
 	}
 	
-	private void assertParse(final String content, final Inline... inlines) {
-		final List<Inline> expected= Arrays.asList(inlines);
-		final List<Inline> actual= createInlines().parse(CommonmarkAsserts.newContext(),
-				new TextSegment(LineSequence.create(content)), true );
-		for (int x= 0; x < expected.size() && x < actual.size(); ++x) {
-			assertEquivalent(x, expected.get(x), actual.get(x));
-		}
-		assertEquals(expected, actual);
-	}
-	
-	private void assertEquivalent(final int index, final Inline expected, final Inline actual) {
-		final String message= "inline at " + index;
-		assertEquals(message + " type", expected.getClass(), actual.getClass());
-		assertEquals(message + " startOffset", expected.getStartOffset(), actual.getStartOffset());
-		assertEquals(message + " length", expected.getLength(), actual.getLength());
-		assertEquals(message, expected, actual);
-	}
-	
 	private InlineParser createInlines() {
 		return new InlineParser(ImCollections.newList(
 				new LineBreakSpan(), new StringCharactersSpan(), new AllCharactersSpan() ));
diff --git a/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/LineBreakSpanTest.java b/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/LineBreakSpanTest.java
index 4c40cbe..149d04c 100644
--- a/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/LineBreakSpanTest.java
+++ b/docmlet/org.eclipse.statet.docmlet.wikitext.commonmark.core-tests/src/org/eclipse/statet/internal/docmlet/wikitext/commonmark/core/inlines/LineBreakSpanTest.java
@@ -18,6 +18,9 @@
 
 import org.junit.Test;
 
+import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.Commonmark;
+import org.eclipse.statet.internal.docmlet.wikitext.commonmark.core.Line;
+
 
 public class LineBreakSpanTest extends AbstractSourceSpanTest {
 	
@@ -37,4 +40,39 @@
 		assertNoInline(createCursor("one"));
 	}
 	
+	@Test
+	public void parse_CommonMarkStrict() {
+		parse(Commonmark.newInlineParserCommonMarkStrict());
+	}
+	
+	@Test
+	public void parse_Markdown() {
+		parse(Commonmark.newInlineParserMarkdown());
+	}
+	
+	private void parse(final InlineParser parser) {
+		final Line line= new Line(0, 1, 0, "test", "\n");
+		assertParse("a \\\\\nb", parser,
+				new Characters(line, 0, 2, 2, "a "),
+				new EscapedCharacter(line, 2, '\\'),
+				new SoftLineBreak(line, 4, 1, 1),
+				new Characters(line, 5, 1, 1, "b") );
+		assertParse("a \\\\\\\nb", parser,
+				new Characters(line, 0, 2, 2, "a "),
+				new EscapedCharacter(line, 2, '\\'),
+				new HardLineBreak(line, 4, 2, 2),
+				new Characters(line, 6, 1, 1, "b") );
+		
+		assertParse("a \\\\\r\nb", parser,
+				new Characters(line, 0, 2, 2, "a "),
+				new EscapedCharacter(line, 2, '\\'),
+				new SoftLineBreak(line, 4, 2, 1),
+				new Characters(line, 6, 1, 1, "b") );
+		assertParse("a \\\\\\\r\nb", parser,
+				new Characters(line, 0, 2, 2, "a "),
+				new EscapedCharacter(line, 2, '\\'),
+				new HardLineBreak(line, 4, 3, 2),
+				new Characters(line, 7, 1, 1, "b") );
+	}
+	
 }