Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for ordinals #2752

Merged
merged 2 commits into from
Apr 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static String format(String inField) {
Objects.requireNonNull(inField);

String toFormat = underscoreMatcher.matcher(inField).replaceAll(replacementChar);
toFormat = Normalizer.normalize(LaTeX2Unicode.convert(toFormat), Normalizer.Form.NFKC);
toFormat = Normalizer.normalize(LaTeX2Unicode.convert(toFormat), Normalizer.Form.NFC);
return underscorePlaceholderMatcher.matcher(toFormat).replaceAll("_");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void testFormatStripLatexCommands() {
@Test
public void testFormatTextit() {
// See #1464
assertEquals("text", formatter.format("\\textit{text}"));
assertEquals("\uD835\uDC61\uD835\uDC52\uD835\uDC65\uD835\uDC61", formatter.format("\\textit{text}"));
}


Expand Down Expand Up @@ -167,4 +167,29 @@ public void testConversionOfUnderscoreWithBraces() {
assertEquals("Lorem ipsum_(lorem ipsum)", formatter.format("Lorem ipsum_{lorem ipsum}"));
}

@Test
public void testConversionOfOrdinal1st() {
assertEquals("1ˢᵗ", formatter.format("1\\textsuperscript{st}"));
}

@Test
public void testConversionOfOrdinal2nd() {
assertEquals("2ⁿᵈ", formatter.format("2\\textsuperscript{nd}"));
}

@Test
public void testConversionOfOrdinal3rd() {
assertEquals("3ʳᵈ", formatter.format("3\\textsuperscript{rd}"));
}

@Test
public void testConversionOfOrdinal4th() {
assertEquals("4ᵗʰ", formatter.format("4\\textsuperscript{th}"));
}

@Test
public void testConversionOfOrdinal9th() {
assertEquals("9ᵗʰ", formatter.format("9\\textsuperscript{th}"));
}

}