Skip to content

Commit 8e3b5e3

Browse files
committed
Merge pull request #1980 from jwarwick/doc_typos
Fixing doc typos in ExUnit and Kernel.Typespec
2 parents e169c0f + 9fcab6e commit 8e3b5e3

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

lib/elixir/lib/kernel/typespec.ex

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ defmodule Kernel.Typespec do
2121
expressed the same way: `pid()` or simply `pid`. Parametrized types are also
2222
supported (`list(integer`) and so are remote types (`Enum.t`).
2323
24-
For integers and atoms literals are allowed as types (ex. `1`, `:atom` or
25-
`false`). All other types are built up of unions of predefined types. Certain
26-
shorthands are allowed, such as `[...]`, `<<>>` and `{...}`).
24+
Integers and atom literals are allowed as types (ex. `1`, `:atom` or
25+
`false`). All other types are built of unions of predefined types. Certain
26+
shorthands are allowed, such as `[...]`, `<<>>` and `{...}`.
2727
2828
### Predefined types
2929
@@ -57,17 +57,17 @@ defmodule Kernel.Typespec do
5757
5858
Integer :: integer
5959
| ElixirInteger # ..., -1, 0, 1, ... 42 ...
60-
| ElixirInteger..ElixirInteger # specifies an integer range
60+
| ElixirInteger..ElixirInteger # an integer range
6161
6262
List :: list(Type) # proper list ([]-terminated)
6363
| improper_list(Type1, Type2) # Type1=contents, Type2=termination
6464
| maybe_improper_list(Type1, Type2) # Type1 and Type2 as above
6565
| nonempty_list(Type) # proper non-empty list
6666
| [] # empty list
6767
| [Type] # shorthand for list(Type)
68-
| [Type, ...] # sharthand for nonempty_list(Type)
68+
| [Type, ...] # shorthand for nonempty_list(Type)
6969
70-
Tuple :: tuple # stands for a tuple of any size
70+
Tuple :: tuple # a tuple of any size
7171
| {} # empty tuple
7272
| { TList }
7373
@@ -185,13 +185,13 @@ defmodule Kernel.Typespec do
185185
use the `char_list` type which is a synonym for `string`. If you use `string`,
186186
you'll get a warning from the compiler.
187187
188-
If you want to refer to the "string" type (the one operated by functions in
189-
the String module), use `String.t` type instead.
188+
If you want to refer to the "string" type (the one operated on by functions in
189+
the `String` module), use `String.t` type instead.
190190
"""
191191

192192
@doc """
193193
Defines a type.
194-
This macro is the one responsible for handling the attribute `@type`.
194+
This macro is responsible for handling the attribute `@type`.
195195
196196
## Examples
197197
@@ -206,7 +206,7 @@ defmodule Kernel.Typespec do
206206

207207
@doc """
208208
Defines an opaque type.
209-
This macro is the one responsible for handling the attribute `@opaque`.
209+
This macro is responsible for handling the attribute `@opaque`.
210210
211211
## Examples
212212
@@ -221,7 +221,7 @@ defmodule Kernel.Typespec do
221221

222222
@doc """
223223
Defines a private type.
224-
This macro is the one responsible for handling the attribute `@typep`.
224+
This macro is responsible for handling the attribute `@typep`.
225225
226226
## Examples
227227
@@ -236,7 +236,7 @@ defmodule Kernel.Typespec do
236236

237237
@doc """
238238
Defines a spec.
239-
This macro is the one responsible for handling the attribute `@spec`.
239+
This macro is responsible for handling the attribute `@spec`.
240240
241241
## Examples
242242
@@ -251,7 +251,7 @@ defmodule Kernel.Typespec do
251251

252252
@doc """
253253
Defines a callback.
254-
This macro is the one responsible for handling the attribute `@callback`.
254+
This macro is responsible for handling the attribute `@callback`.
255255
256256
## Examples
257257
@@ -408,10 +408,10 @@ defmodule Kernel.Typespec do
408408
@doc """
409409
Returns all type docs available from the module's beam code.
410410
411-
It is returned as a list of tuples where the first element is the pair of type
411+
The result is returned as a list of tuples where the first element is the pair of type
412412
name and arity and the second element is the documentation.
413413
414-
The module has to have a corresponding beam file on the disk which can be
414+
The module must have a corresponding beam file which can be
415415
located by the runtime system.
416416
"""
417417
@spec beam_typedocs(module | binary) :: [tuple] | nil
@@ -428,10 +428,10 @@ defmodule Kernel.Typespec do
428428
@doc """
429429
Returns all types available from the module's beam code.
430430
431-
It is returned as a list of tuples where the first
431+
The result is returned as a list of tuples where the first
432432
element is the type (`:typep`, `:type` and `:opaque`).
433433
434-
The module has to have a corresponding beam file on the disk which can be
434+
The module must have a corresponding beam file which can be
435435
located by the runtime system.
436436
"""
437437
@spec beam_types(module | binary) :: [tuple] | nil
@@ -456,10 +456,10 @@ defmodule Kernel.Typespec do
456456
@doc """
457457
Returns all specs available from the module's beam code.
458458
459-
It is returned as a list of tuples where the first
459+
The result is returned as a list of tuples where the first
460460
element is spec name and arity and the second is the spec.
461461
462-
The module has to have a corresponding beam file on the disk which can be
462+
The module must have a corresponding beam file which can be
463463
located by the runtime system.
464464
"""
465465
@spec beam_specs(module | binary) :: [tuple] | nil
@@ -470,10 +470,10 @@ defmodule Kernel.Typespec do
470470
@doc """
471471
Returns all callbacks available from the module's beam code.
472472
473-
It is returned as a list of tuples where the first
473+
The result is returned as a list of tuples where the first
474474
element is spec name and arity and the second is the spec.
475475
476-
The module has to have a corresponding beam file on the disk
476+
The module must have a corresponding beam file
477477
which can be located by the runtime system.
478478
"""
479479
@spec beam_callbacks(module | binary) :: [tuple] | nil

lib/ex_unit/lib/ex_unit/callbacks.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ defmodule ExUnit.Callbacks do
3030
be called sequentially. In the case of `setup_all` and `teardown_all` callbacks,
3131
each `setup_all` will be called only once before the first test's `setup` and each
3232
`teardown_all` will be called once after the last test. No callback runs if the
33-
test case has no tests or all tests were fltered out via include/exclude.
33+
test case has no tests or all tests were filtered out via `include`/`exclude`.
3434
3535
## Examples
3636
@@ -41,7 +41,7 @@ defmodule ExUnit.Callbacks do
4141
setup do
4242
IO.puts "This is a setup callback"
4343
44-
# Return extra metadata, it has to be a keyword list
44+
# Return extra metadata, it must be a keyword list
4545
{ :ok, [hello: "world"] }
4646
end
4747

lib/ex_unit/lib/ex_unit/case.ex

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ defmodule ExUnit.Case do
8585
end
8686
8787
In the example above, we have defined a tag called `:cd` that is
88-
read in callbacks to configure the working directory the test is
88+
read in the setup callback to configure the working directory the test is
8989
going to run on. We then use the same context to store the
9090
previous working directory that is reverted to after the test
91-
in a teardown callback.
91+
in the teardown callback.
9292
9393
Tags are also very effective when used with case templates
9494
(`ExUnit.CaseTemplate`) allowing callbacks in the case template
@@ -108,7 +108,7 @@ defmodule ExUnit.Case do
108108
@moduletag :external
109109
110110
If the same key is set via `@tag`, the `@tag` value has higher
111-
preference.
111+
precedence.
112112
113113
### Reserved tags
114114
@@ -117,7 +117,7 @@ defmodule ExUnit.Case do
117117
118118
* `:case` - the test case module
119119
* `:test` - the test name
120-
* `:line` - the line the test was defined
120+
* `:line` - the line on which the test was defined
121121
122122
## Filters
123123
@@ -128,31 +128,31 @@ defmodule ExUnit.Case do
128128
# Exclude all external tests from running
129129
ExUnit.configure exclude: [external: true]
130130
131-
From now on, ExUnit will not run any test that has the external flag set to true.
131+
From now on, ExUnit will not run any test that has the `external` flag set to true.
132132
This behaviour can be reversed with the `:include` option which is usually passed
133133
through the command line:
134134
135135
mix test --include external:true
136136
137-
The command above will have override exclude configuration, running all tests,
138-
including the ones that have the external flag set to true.
137+
The command above will override the excluded configuration, running all tests,
138+
including the ones that have the `external` flag set to true.
139139
140-
Another use case for using tags and filters is to exclude all tests that have
140+
Another use case for tags and filters is to exclude all tests that have
141141
a particular tag by default, regardless of its value, and include only a certain
142142
subset:
143143
144144
ExUnit.configure exclude: :os, include: [os: :unix]
145145
146146
Keep in mind that all tests are included by default, so unless they are
147-
excluded first, the include option has no effect.
147+
excluded first, the `include` option has no effect.
148148
"""
149149

150150
@doc false
151151
defmacro __using__(opts) do
152152
async = Keyword.get(opts, :async, false)
153153

154154
unless Process.whereis(ExUnit.Server) do
155-
raise "cannot use ExUnit.Case without starting ExUnit application, " <>
155+
raise "cannot use ExUnit.Case without starting the ExUnit application, " <>
156156
"please call ExUnit.start() or explicitly start the :ex_unit app"
157157
end
158158

@@ -186,7 +186,7 @@ defmodule ExUnit.Case do
186186
Provides a convenient macro that allows a test to be
187187
defined with a string. This macro automatically inserts
188188
the atom `:ok` as the last line of the test. That said,
189-
a passing test always returns `:ok`, but, more important,
189+
a passing test always returns `:ok`, but, more importantly,
190190
it forces Elixir to not tail call optimize the test and
191191
therefore avoids hiding lines from the backtrace.
192192

0 commit comments

Comments
 (0)