Merge "Replace double dashes with a simple dash in Prolog generated label names"
This commit is contained in:
@@ -297,7 +297,8 @@ public class PrologRuleEvaluator {
|
||||
try {
|
||||
return LabelType.checkName(name);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return LabelType.checkName("Invalid-Prolog-Rules-Label-Name--" + sanitizeLabelName(name));
|
||||
String newName = "Invalid-Prolog-Rules-Label-Name-" + sanitizeLabelName(name);
|
||||
return LabelType.checkName(newName.replace("--", "-"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,18 +30,18 @@ public class PrologRuleEvaluatorTest {
|
||||
@Test
|
||||
public void labelWithSpacesIsTransformed() {
|
||||
assertThat(PrologRuleEvaluator.checkLabelName("Label with spaces"))
|
||||
.isEqualTo("Invalid-Prolog-Rules-Label-Name--Labelwithspaces");
|
||||
.isEqualTo("Invalid-Prolog-Rules-Label-Name-Labelwithspaces");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void labelStartingWithADashIsTransformed() {
|
||||
assertThat(PrologRuleEvaluator.checkLabelName("-dashed-label"))
|
||||
.isEqualTo("Invalid-Prolog-Rules-Label-Name---dashed-label");
|
||||
.isEqualTo("Invalid-Prolog-Rules-Label-Name-dashed-label");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void labelWithInvalidCharactersIsTransformed() {
|
||||
assertThat(PrologRuleEvaluator.checkLabelName("*urgent*"))
|
||||
.isEqualTo("Invalid-Prolog-Rules-Label-Name--urgent");
|
||||
.isEqualTo("Invalid-Prolog-Rules-Label-Name-urgent");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user