@@ -300,7 +300,7 @@ defmodule ExUnit.DocTest do
300300 actual ->
301301 reraise ExUnit.AssertionError ,
302302 [ message: "Doctest failed" ,
303- expr: "#{ unquote ( String . strip ( expr ) ) } === #{ unquote ( String . strip ( expected ) ) } " ,
303+ expr: "#{ unquote ( String . trim ( expr ) ) } === #{ unquote ( String . trim ( expected ) ) } " ,
304304 left: actual ] ,
305305 unquote ( stack )
306306 end
@@ -318,7 +318,7 @@ defmodule ExUnit.DocTest do
318318 actual ->
319319 reraise ExUnit.AssertionError ,
320320 [ message: "Doctest failed" ,
321- expr: "inspect(#{ unquote ( String . strip ( expr ) ) } ) === #{ unquote ( String . strip ( expected ) ) } " ,
321+ expr: "inspect(#{ unquote ( String . trim ( expr ) ) } ) === #{ unquote ( String . trim ( expected ) ) } " ,
322322 left: actual ] ,
323323 unquote ( stack )
324324 end
@@ -330,7 +330,7 @@ defmodule ExUnit.DocTest do
330330
331331 quote do
332332 stack = unquote ( stack )
333- expr = unquote ( String . strip ( expr ) )
333+ expr = unquote ( String . trim ( expr ) )
334334 spec = inspect ( unquote ( exception ) ) <> " with message " <> inspect ( unquote ( message ) )
335335
336336 try do
@@ -369,7 +369,7 @@ defmodule ExUnit.DocTest do
369369 quote do
370370 reraise ExUnit.AssertionError ,
371371 [ message: "Doctest did not compile, got: #{ unquote ( message ) } " ,
372- expr: unquote ( String . strip ( expr ) ) ] ,
372+ expr: unquote ( String . trim ( expr ) ) ] ,
373373 unquote ( stack )
374374 end
375375 end
@@ -429,7 +429,7 @@ defmodule ExUnit.DocTest do
429429 end
430430
431431 defp adjust_indent ( :text , [ line | rest ] , line_no , adjusted_lines , indent , module ) do
432- case String . starts_with? ( String . lstrip ( line ) , @ iex_prompt ) do
432+ case String . starts_with? ( String . trim_leading ( line ) , @ iex_prompt ) do
433433 true ->
434434 adjust_indent ( :prompt , [ line | rest ] , line_no , adjusted_lines , get_indent ( line , indent ) , module )
435435 false ->
@@ -440,7 +440,7 @@ defmodule ExUnit.DocTest do
440440 defp adjust_indent ( kind , [ line | rest ] , line_no , adjusted_lines , indent , module ) when kind in [ :prompt , :after_prompt ] do
441441 stripped_line = strip_indent ( line , indent )
442442
443- case String . lstrip ( line ) do
443+ case String . trim_leading ( line ) do
444444 "" ->
445445 raise Error , line: line_no , module: module ,
446446 message: "expected non-blank line to follow iex> prompt"
@@ -472,7 +472,7 @@ defmodule ExUnit.DocTest do
472472 cond do
473473 stripped_line == "" ->
474474 adjust_indent ( :text , rest , line_no + 1 , [ { stripped_line , line_no } | adjusted_lines ] , 0 , module )
475- String . starts_with? ( String . lstrip ( line ) , @ iex_prompt ) ->
475+ String . starts_with? ( String . trim_leading ( line ) , @ iex_prompt ) ->
476476 adjust_indent ( :prompt , [ line | rest ] , line_no , adjusted_lines , indent , module )
477477 true ->
478478 adjust_indent ( :code , rest , line_no + 1 , [ { stripped_line , line_no } | adjusted_lines ] , indent , module )
@@ -587,7 +587,7 @@ defmodule ExUnit.DocTest do
587587 case string do
588588 "** (" <> error ->
589589 [ mod , message ] = :binary . split ( error , ")" )
590- { :error , Module . concat ( [ mod ] ) , String . lstrip ( message ) }
590+ { :error , Module . concat ( [ mod ] ) , String . trim_leading ( message ) }
591591 _ ->
592592 if string =~ ~r/ ^#[A-Z][\w \. ]*<.*>$/ do
593593 { :inspect , inspect ( string ) }
0 commit comments