File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 333
333
# Issue 36953
334
334
@test replace (" abc" , " " => " _" , count= 1 ) == " _abc"
335
335
336
+ # tests for io::IO API (in addition to internals exercised above):
337
+ let buf = IOBuffer ()
338
+ replace (buf, " aaa" , ' a' => ' z' , count= 0 )
339
+ replace (buf, " aaa" , ' a' => ' z' , count= 1 )
340
+ replace (buf, " bbb" , ' a' => ' z' )
341
+ replace (buf, " aaa" , ' a' => ' z' )
342
+ @test String (take! (buf)) == " aaazaabbbzzz"
343
+ end
344
+ let tempfile = tempname ()
345
+ open (tempfile, " w" ) do f
346
+ replace (f, " aaa" , ' a' => ' z' , count= 0 )
347
+ replace (f, " aaa" , ' a' => ' z' , count= 1 )
348
+ replace (f, " bbb" , ' a' => ' z' )
349
+ replace (f, " aaa" , ' a' => ' z' )
350
+ print (f, " \n " )
351
+ end
352
+ @test read (tempfile, String) == " aaazaabbbzzz\n "
353
+ end
336
354
end
337
355
338
356
@testset " replace many" begin
You can’t perform that action at this time.
0 commit comments