Skip to content

Commit 2fbc868

Browse files
committed
Review doctests in stdlib to use extended doctests
1 parent 2075a9b commit 2fbc868

File tree

3 files changed

+15
-25
lines changed

3 files changed

+15
-25
lines changed

lib/elixir/lib/bitwise.ex

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ defmodule Bitwise do
77
your module:
88
99
iex> use Bitwise
10-
...> bnot 1
10+
iex> bnot 1
1111
-2
12-
13-
iex> use Bitwise
14-
...> 1 &&& 1
12+
iex> 1 &&& 1
1513
1
1614
1715
You can select to include only or skip operators by passing options:
@@ -127,4 +125,4 @@ defmodule Bitwise do
127125
defmacro left >>> right do
128126
quote do: __op__ :bsr, unquote(left), unquote(right)
129127
end
130-
end
128+
end

lib/elixir/lib/dict.ex

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,9 @@ defmodule Dict do
131131
## Examples
132132
133133
iex> d = HashDict.new([a: 1])
134-
...> Dict.has_key?(d, :a)
134+
iex> Dict.has_key?(d, :a)
135135
true
136-
137-
iex> d = HashDict.new([a: 1])
138-
...> Dict.has_key?(d, :b)
136+
iex> Dict.has_key?(d, :b)
139137
false
140138
141139
"""
@@ -151,15 +149,11 @@ defmodule Dict do
151149
## Examples
152150
153151
iex> d = HashDict.new([a: 1])
154-
...> Dict.get(d, :a)
152+
iex> Dict.get(d, :a)
155153
1
156-
157-
iex> d = HashDict.new([a: 1])
158-
...> Dict.get(d, :b)
154+
iex> Dict.get(d, :b)
159155
nil
160-
161-
iex> d = HashDict.new([a: 1])
162-
...> Dict.get(d, :b, 3)
156+
iex> Dict.get(d, :b, 3)
163157
3
164158
"""
165159
@spec get(t, key, value) :: value
@@ -179,11 +173,9 @@ defmodule Dict do
179173
## Examples
180174
181175
iex> d = HashDict.new([a: 1])
182-
...> Dict.fetch(d, :a)
176+
iex> Dict.fetch(d, :a)
183177
{ :ok, 1 }
184-
185-
iex> d = HashDict.new([a: 1])
186-
...> Dict.fetch(d, :b)
178+
iex> Dict.fetch(d, :b)
187179
:error
188180
189181
"""
@@ -199,7 +191,7 @@ defmodule Dict do
199191
## Examples
200192
201193
iex> d = HashDict.new([a: 1])
202-
...> Dict.fetch!(d, :a)
194+
iex> Dict.fetch!(d, :a)
203195
1
204196
iex> Dict.fetch!(d, :b)
205197
** (KeyError) key not found: :b
@@ -424,11 +416,11 @@ defmodule Dict do
424416
## Examples
425417
426418
iex> d = HashDict.new([a: 1, b: 2])
419+
...>
427420
...> d = Dict.take(d, [:a, :c, :d])
428421
...> Dict.to_list(d)
429422
[a: 1]
430-
431-
iex> d = HashDict.new([a: 1, b: 2])
423+
...>
432424
...> d = Dict.take(d, [:c, :d])
433425
...> Dict.to_list(d)
434426
[]

lib/elixir/lib/string.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ defmodule String do
752752
753753
"""
754754
@spec to_integer(t) :: {integer, t} | :error
755-
755+
756756
def to_integer(string) do
757757
{result, remainder} = :string.to_integer(binary_to_list(string))
758758
case result do
@@ -785,7 +785,7 @@ defmodule String do
785785
charlist = binary_to_list(string)
786786
{result, remainder} = :string.to_float(charlist)
787787
case result do
788-
:error ->
788+
:error ->
789789
{int_result, int_remainder} = :string.to_integer(charlist)
790790
case int_result do
791791
:error -> :error

0 commit comments

Comments
 (0)