Skip to content

Commit

Permalink
Fix #152
Browse files Browse the repository at this point in the history
  • Loading branch information
enridaga committed Jun 30, 2023
1 parent 5925c43 commit 7a48cad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public Character asType(NodeValue nodeValue) {
public NodeValueString asNodeValue(Character object) {
return (NodeValueString) NodeValue.makeNodeString(object.toString());
}

public boolean compatibleWith(NodeValue nodeValue){
return nodeValue.getClass().equals(getNodeValueType()) && nodeValue.getString().length() == 1;
}
}

public static class StringConverter implements NodeValueConverter<String,NodeValueString> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ public void testWordUtilsFunctions() {
testStringFunction("fx:WordUtils.uncapitalize", WordUtils.uncapitalize("TEST"), "TEST");
}

@Test
public void testStringReplace(){
testStringFunction("fx:String.replace", "test".replace("te", "fe"), "test", Lists.newArrayList("te", "fe"));
}
@Test
public void testStringFunctions(){
testStringFunction("fx:String.trim", " test ".trim(), "test");
Expand All @@ -423,8 +427,8 @@ public void testStringFunctions(){
testStringFunction("fx:String.indexOf", String.valueOf("test".indexOf("e")), "test", Lists.newArrayList("e"));
testStringFunction("fx:String.startsWith", String.valueOf("test".startsWith("te")), "test", Lists.newArrayList("te"));
testStringFunction("fx:String.endsWith", String.valueOf("test".endsWith("st")), "test", Lists.newArrayList("st"));
testStringFunction("fx:String.replace", "test".replace("te", "fe"), "test", Lists.newArrayList("te", "fe"));
testStringFunction("fx:String.replace", "test".replace("t", "f"), "test", Lists.newArrayList("t", "f"));
testStringFunction("fx:String.replace", "test".replace("te", "fe"), "test", Lists.newArrayList("te", "fe"));
testStringFunction("fx:String.strip", " test \t".strip(), " test \t");
testStringFunction("fx:String.stripLeading", " test \t".stripLeading(), " test \t");
testStringFunction("fx:String.stripTrailing", " test \t".stripTrailing(), " test \t");
Expand Down

0 comments on commit 7a48cad

Please sign in to comment.