File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1251,6 +1251,10 @@ def inspect
1251
1251
result2 = @s . rb_enc_interned_str_cstr ( str , Encoding ::UTF_8 )
1252
1252
result1 . should_not . equal? ( result2 )
1253
1253
end
1254
+
1255
+ it "returns the same string as String#-@" do
1256
+ @s . rb_enc_interned_str_cstr ( "hello" , Encoding ::UTF_8 ) . should . equal? ( -"hello" )
1257
+ end
1254
1258
end
1255
1259
1256
1260
describe "rb_str_to_interned_str" do
@@ -1267,5 +1271,15 @@ def inspect
1267
1271
result2 = @s . rb_str_to_interned_str ( str )
1268
1272
result1 . should . equal? ( result2 )
1269
1273
end
1274
+
1275
+ it "returns different frozen strings for different encodings" do
1276
+ result1 = @s . rb_str_to_interned_str ( "hello" . force_encoding ( Encoding ::US_ASCII ) )
1277
+ result2 = @s . rb_str_to_interned_str ( "hello" . force_encoding ( Encoding ::UTF_8 ) )
1278
+ result1 . should_not . equal? ( result2 )
1279
+ end
1280
+
1281
+ it "returns the same string as String#-@" do
1282
+ @s . rb_str_to_interned_str ( "hello" ) . should . equal? ( -"hello" )
1283
+ end
1270
1284
end
1271
1285
end
You can’t perform that action at this time.
0 commit comments