Skip to content

Commit fc0af05

Browse files
author
José Valim
committed
Improve doctest stripping, closes #1678
1 parent 14272c9 commit fc0af05

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

lib/ex_unit/lib/ex_unit/doc_test.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ defmodule ExUnit.DocTest do
383383
end
384384

385385
defp strip_indent(line, indent) do
386-
line |> String.slice(indent, String.length(line))
386+
String.slice(line, indent, String.length(line)) || ""
387387
end
388388

389389
defp extract_tests([], _line, "", "", [], _) do

lib/ex_unit/test/ex_unit/doc_test_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ defmodule ExUnit.DocTestTest.IndentationNotEnough do
141141
def not_enough, do: :ok
142142
end
143143

144-
145144
defmodule ExUnit.DocTestTest do
146145
use ExUnit.Case
147146

0 commit comments

Comments
 (0)