@@ -51,7 +51,7 @@ function missingdocs(doc::Documents.Document)
51
51
end
52
52
end
53
53
push! (doc. internal. errors, :missing_docs )
54
- Utilities. warn (Utilities . takebuf_str (b ))
54
+ Utilities. warn (String ( take! (b) ))
55
55
end
56
56
end
57
57
@@ -303,31 +303,32 @@ function sanitise(buffer)
303
303
for line in eachline (seekstart (buffer))
304
304
println (out, rstrip (line))
305
305
end
306
- remove_term_colors (rstrip (Utilities . takebuf_str ( out), ' \n ' ))
306
+ remove_term_colors (rstrip (String ( take! ( out) ), ' \n ' ))
307
307
end
308
308
309
309
import . Utilities. TextDiff
310
310
311
311
function report (result:: Result , str, doc:: Documents.Document )
312
- buffer = IOBuffer ()
313
- println (buffer, " =====[Test Error]" , " =" ^ 30 )
314
- println (buffer)
315
- printstyled (buffer, " > File: " , result. file, " \n " , color= :cyan )
316
- printstyled (buffer, " \n > Code block:\n " , color= :cyan )
317
- println (buffer, " \n ```jldoctest" )
318
- println (buffer, result. code)
319
- println (buffer, " ```" )
312
+ iob = IOBuffer ()
313
+ ioc = IOContext (iob, :color => Base. have_color)
314
+ println (ioc, " =====[Test Error]" , " =" ^ 30 )
315
+ println (ioc)
316
+ printstyled (ioc, " > File: " , result. file, " \n " , color= :cyan )
317
+ printstyled (ioc, " \n > Code block:\n " , color= :cyan )
318
+ println (ioc, " \n ```jldoctest" )
319
+ println (ioc, result. code)
320
+ println (ioc, " ```" )
320
321
if ! isempty (result. input)
321
- printstyled (buffer , " \n > Subexpression:\n " , color= :cyan )
322
- print_indented (buffer , result. input; indent = 4 )
322
+ printstyled (ioc , " \n > Subexpression:\n " , color= :cyan )
323
+ print_indented (ioc , result. input; indent = 4 )
323
324
end
324
325
warning = Base. have_color ? " " : " (REQUIRES COLOR)"
325
- printstyled (buffer , " \n > Output Diff" , warning, " :\n\n " , color= :cyan )
326
+ printstyled (ioc , " \n > Output Diff" , warning, " :\n\n " , color= :cyan )
326
327
diff = TextDiff. Diff {TextDiff.Words} (result. output, rstrip (str))
327
- Utilities. TextDiff. showdiff (buffer , diff)
328
- println (buffer , " \n\n " , " =====[End Error]=" , " =" ^ 30 )
328
+ Utilities. TextDiff. showdiff (ioc , diff)
329
+ println (ioc , " \n\n " , " =====[End Error]=" , " =" ^ 30 )
329
330
push! (doc. internal. errors, :doctest )
330
- printstyled (Utilities . takebuf_str (buffer ), color= :normal )
331
+ printstyled (String ( take! (iob) ), color= :normal )
331
332
end
332
333
333
334
function print_indented (buffer:: IO , str:: AbstractString ; indent = 4 )
381
382
382
383
function savebuffer! (out, buf)
383
384
n = bytesavailable (seekstart (buf))
384
- n > 0 ? push! (out, rstrip (Utilities . takebuf_str ( buf))) : out
385
+ n > 0 ? push! (out, rstrip (String ( take! ( buf) ))) : out
385
386
end
386
387
387
388
function takeuntil! (r, buf, lines)
0 commit comments