@@ -1201,28 +1201,50 @@ def inspect
1201
1201
1202
1202
describe "rb_str_locktmp" do
1203
1203
it "raises an error when trying to lock an already locked string" do
1204
- str = "test"
1204
+ str = + "test"
1205
1205
@s . rb_str_locktmp ( str ) . should == str
1206
1206
-> { @s . rb_str_locktmp ( str ) } . should raise_error ( RuntimeError , 'temporal locking already locked string' )
1207
1207
end
1208
1208
1209
1209
it "locks a string so that modifications would raise an error" do
1210
- str = "test"
1210
+ str = + "test"
1211
1211
@s . rb_str_locktmp ( str ) . should == str
1212
1212
-> { str . upcase! } . should raise_error ( RuntimeError , 'can\'t modify string; temporarily locked' )
1213
1213
end
1214
+
1215
+ ruby_bug "#20998" , "" ..."3.5" do
1216
+ it "raises FrozenError if string is frozen" do
1217
+ str = -"rb_str_locktmp"
1218
+ -> { @s . rb_str_locktmp ( str ) } . should raise_error ( FrozenError )
1219
+
1220
+ str = +"rb_str_locktmp"
1221
+ str . freeze
1222
+ -> { @s . rb_str_locktmp ( str ) } . should raise_error ( FrozenError )
1223
+ end
1224
+ end
1214
1225
end
1215
1226
1216
1227
describe "rb_str_unlocktmp" do
1217
1228
it "unlocks a locked string" do
1218
- str = "test"
1229
+ str = + "test"
1219
1230
@s . rb_str_locktmp ( str )
1220
1231
@s . rb_str_unlocktmp ( str ) . should == str
1221
1232
str . upcase! . should == "TEST"
1222
1233
end
1223
1234
1224
1235
it "raises an error when trying to unlock an already unlocked string" do
1225
- -> { @s . rb_str_unlocktmp ( "test" ) } . should raise_error ( RuntimeError , 'temporal unlocking already unlocked string' )
1236
+ -> { @s . rb_str_unlocktmp ( +"test" ) } . should raise_error ( RuntimeError , 'temporal unlocking already unlocked string' )
1237
+ end
1238
+
1239
+ ruby_bug "#20998" , "" ..."3.5" do
1240
+ it "raises FrozenError if string is frozen" do
1241
+ str = -"rb_str_locktmp"
1242
+ -> { @s . rb_str_unlocktmp ( str ) } . should raise_error ( FrozenError )
1243
+
1244
+ str = +"rb_str_locktmp"
1245
+ str . freeze
1246
+ -> { @s . rb_str_unlocktmp ( str ) } . should raise_error ( FrozenError )
1247
+ end
1226
1248
end
1227
1249
end
1228
1250
0 commit comments