Skip to content

Commit

Permalink
Improving methods(+) doctest
Browse files Browse the repository at this point in the history
The `methods(+)` doctest seems to fail periodically due to the order
of the methods changing. It appears that blocks of these methods
typically stick together so I picked a nice reading block and attempted
to format with the least amount of ellipsis.

Here is an interesting failure which caused me to update the layout
of the doctest. Before this commit we used the following as a doctest:

```jldoctest
julia> methods(+)
 # 166 methods for generic function "+":
...
+(a::Float16, b::Float16) at float16.jl:136...
+(x::Float32, y::Float32) at float.jl:206...
+(x::Float64, y::Float64) at float.jl:207...
+(x::Bool, z::Complex{Bool}) at complex.jl:137...
+(x::Bool, y::Bool) at bool.jl:36...
+(x::Bool) at bool.jl:33...
+{T<:AbstractFloat}(x::Bool, y::T) at bool.jl:43...
+(x::Bool, z::Complex) at complex.jl:144...
+(x::Bool, A::AbstractArray{Bool,N<:Any}) at arraymath.jl:105...
+(x::Char, y::Integer) at char.jl:40
...
+(a, b, c, xs...) at operators.jl:119
```

The output was as follows:
```
 # 166 methods for generic function "+":
+(a::Float16, b::Float16) at float16.jl:136
+(x::Float32, y::Float32) at float.jl:206
+(x::Float64, y::Float64) at float.jl:207
+(x::Bool, z::Complex{Bool}) at complex.jl:137
+(x::Bool, y::Bool) at bool.jl:36
+(x::Bool) at bool.jl:33
+{T<:AbstractFloat}(x::Bool, y::T) at bool.jl:43
+(x::Bool, z::Complex) at complex.jl:144
+(x::Bool, A::AbstractArray{Bool,N<:Any}) at arraymath.jl:105
+(x::Char, y::Integer) at char.jl:40
...
+(a, b, c, xs...) at operators.jl:119
```
  • Loading branch information
omus committed Jul 8, 2016
1 parent 921dd30 commit 65e6b12
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions doc/manual/methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,16 @@ Julia language. Core operations typically have dozens of methods:
.. doctest::

julia> methods(+)
# 166 methods for generic function "+":
...
+(a::Float16, b::Float16) at float16.jl:136...
+(x::Float32, y::Float32) at float.jl:206...
+(x::Float64, y::Float64) at float.jl:207...
+(x::Bool, z::Complex{Bool}) at complex.jl:137...
+(x::Bool, y::Bool) at bool.jl:36...
+(x::Bool) at bool.jl:33...
+{T<:AbstractFloat}(x::Bool, y::T) at bool.jl:43...
+(x::Bool, z::Complex) at complex.jl:144...
+(x::Bool, A::AbstractArray{Bool,N<:Any}) at arraymath.jl:105...
# 166 methods for generic function "+":...
+(a::Float16, b::Float16) at float16.jl:136
+(x::Float32, y::Float32) at float.jl:206
+(x::Float64, y::Float64) at float.jl:207
+(x::Bool, z::Complex{Bool}) at complex.jl:137
+(x::Bool, y::Bool) at bool.jl:36
+(x::Bool) at bool.jl:33
+{T<:AbstractFloat}(x::Bool, y::T) at bool.jl:43
+(x::Bool, z::Complex) at complex.jl:144
+(x::Bool, A::AbstractArray{Bool,N<:Any}) at arraymath.jl:105
+(x::Char, y::Integer) at char.jl:40
...
+(a, b, c, xs...) at operators.jl:119
Expand Down

0 comments on commit 65e6b12

Please sign in to comment.