File tree Expand file tree Collapse file tree 3 files changed +5
-7
lines changed
spec/truffle/tags/core/string
truffle/src/main/java/org/jruby/truffle/nodes/core Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change 1
1
fails:String#capitalize taints resulting string when self is tainted
2
2
fails:String#capitalize is locale insensitive (only upcases a-z and only downcases A-Z)
3
- fails:String#capitalize returns subclass instances when called on a subclass
4
- fails:String#capitalize! raises a RuntimeError when self is frozen
3
+ fails:String#capitalize returns subclass instances when called on a subclass
Original file line number Diff line number Diff line change 1
1
fails:String#downcase is locale insensitive (only replaces A-Z)
2
2
fails:String#downcase taints result when self is tainted
3
3
fails:String#downcase returns a subclass instance for subclasses
4
- fails:String#downcase! raises a RuntimeError when self is frozen
Original file line number Diff line number Diff line change @@ -774,12 +774,11 @@ public DowncaseBangNode(DowncaseBangNode prev) {
774
774
public RubyBasicObject downcase (RubyString string ) {
775
775
notDesignedForCompilation ();
776
776
777
+ string .checkFrozen (this );
777
778
ByteList newByteList = StringNodesHelper .downcase (string );
778
779
779
780
if (newByteList .equal (string .getBytes ())) {
780
781
return getContext ().getCoreLibrary ().getNilObject ();
781
- } else if (string .isFrozen ()) {
782
- throw new RaiseException (getContext ().getCoreLibrary ().runtimeError ("can't modify frozen string" , this ));
783
782
} else {
784
783
string .set (newByteList );
785
784
return string ;
@@ -1925,11 +1924,12 @@ public CapitalizeBangNode(CapitalizeBangNode prev) {
1925
1924
@ Specialization
1926
1925
public RubyBasicObject capitalizeBang (RubyString string ) {
1927
1926
notDesignedForCompilation ();
1927
+
1928
+ string .checkFrozen (this );
1928
1929
String javaString = string .toString ();
1930
+
1929
1931
if (javaString .isEmpty ()) {
1930
1932
return getContext ().getCoreLibrary ().getNilObject ();
1931
- } else if (string .isFrozen ()) {
1932
- throw new RaiseException (getContext ().getCoreLibrary ().runtimeError ("can't modify frozen string" , this ));
1933
1933
} else {
1934
1934
final ByteList byteListString = StringNodesHelper .capitalize (string );
1935
1935
You can’t perform that action at this time.
0 commit comments