Add tests and more context in the StringRules file

This commit is contained in:
Rick Ossendrijver
2024-05-16 07:47:58 +02:00
parent 3d5678e20e
commit 8ba4f872be
3 changed files with 12 additions and 0 deletions

View File

@@ -246,5 +246,9 @@ final class StringRules {
}
// Rewrite `String#copyValueOf(char[])` to `new String(char[])`.
// Example:
// String.copyValueOf(new char[]);
// -->
// new String(new char[]);
}

View File

@@ -96,4 +96,8 @@ final class StringRulesTest implements RefasterRuleCollectionTestCase {
int testUtf8EncodedLength() {
return "foo".getBytes(UTF_8).length;
}
String testNewStringChar() {
return String.copyValueOf(new char[] {'f', 'o', 'o'});
}
}

View File

@@ -96,4 +96,8 @@ final class StringRulesTest implements RefasterRuleCollectionTestCase {
int testUtf8EncodedLength() {
return Utf8.encodedLength("foo");
}
String testNewStringChar() {
return new String(new char[] {'f', 'o', 'o'});
}
}