make sure single char interpreter name can be parsed

This commit is contained in:
Lee moon soo 2016-11-17 19:55:47 -08:00
parent 6b9525f303
commit 171cbeb003
2 changed files with 9 additions and 1 deletions

View file

@ -171,7 +171,7 @@ public class Paragraph extends Job implements Serializable, Cloneable {
}
scriptHeadIndex = i;
}
if (scriptHeadIndex <= 1) {
if (scriptHeadIndex < 1) {
return null;
}
String head = text.substring(1, scriptHeadIndex + 1);

View file

@ -59,6 +59,14 @@ public class ParagraphTest {
assertEquals("", Paragraph.getScriptBody(text));
}
@Test
public void replSingleCharName() {
String text = "%r a";
assertEquals("r", Paragraph.getRequiredReplName(text));
assertEquals("a", Paragraph.getScriptBody(text));
}
@Test
public void replNameEndsWithWhitespace() {
String text = "%md\r\n###Hello";