/*=============================================================================#
# Copyright (c) 2015-2016 David Green and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# David Green - initial API and implementation in Mylyn
# Stephan Wahlbrink (WalWare.de)
#=============================================================================*/
package de.walware.docmlet.wikitext.internal.commonmark.core.inlines;
import static de.walware.docmlet.wikitext.internal.commonmark.core.inlines.Cursors.createCursor;
import org.junit.Test;
public class HtmlEntitySpanTest extends AbstractSourceSpanTest {
public HtmlEntitySpanTest() {
super(new HtmlEntitySpan());
}
@Test
public void createInline() {
assertNoInline(createCursor("one"));
assertNoInline(createCursor("©"));
assertEntity(6, "©", "© ayyy");
assertEntity(5, "&xa0;", "&xa0; ayyy;");
assertEntity(6, " ", " ");
assertEntity(6, " ", " ");
assertEntity(6, " ", " ab\ncd");
assertEntity(5, " ", " ");
assertEntity(5, " ", " ");
assertEntity(7, "ऒ", "ऒ");
assertEntity(4, "\uFFFD", "");
assertEntity(5, "\uFFFD", "");
assertEntity(8, "𐀀", "𐀀");
assertEntity(5, "\uFFFD", "");
assertEntity(9, "", "");
}
private void assertEntity(int length, String entity, String content) {
assertInline(HtmlEntity.class, 0, length, entity, createCursor(content));
}
}