# Doctests and array printing

**URL:** <https://discourse.julialang.org/t/doctests-and-array-printing/48477>\
**Category:** General Usage\
**Created:** [October 16, 2020, 5:59am UTC](https://discourse.julialang.org/t/doctests-and-array-printing/48477 "2020-10-16T05:59:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Post date:** [October 16, 2020, 5:59am UTC](https://discourse.julialang.org/t/doctests-and-array-printing/48477/1 "2020-10-16T05:59:55Z")

</div>

Printing of arrays changed recently:

```julia
julia> [1] # 1.5
1-element Array{Int64,1}:
 1

julia> [1] # master
1-element Vector{Int64}:
 1

```

This breaks quite some doctests. I would like to have my doctests pass on 1.x and master. What options do I have?

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [October 16, 2020, 6:04am UTC](https://discourse.julialang.org/t/doctests-and-array-printing/48477/2 "2020-10-16T06:04:43Z")

</div>

You can apply [doctest filters](https://juliadocs.github.io/Documenter.jl/stable/man/doctests/#Filtering-Doctests). For this particular case you can try something like [https://github.com/JuliaLang/julia/pull/37085#issuecomment-683356098](https://github.com/JuliaLang/julia/pull/37085#issuecomment-683356098)

---

<div class="post-metadata">

**Author:** ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Post date:** [October 16, 2020, 6:18am UTC](https://discourse.julialang.org/t/doctests-and-array-printing/48477/3 "2020-10-16T06:18:04Z")

</div>

Thanks @fredrikekre Is there a way to apply these globally using the `doctests` function, without touching the docstrings?

```julia
    doctestfilters = [
        r"{([a-zA-Z0-9]+,\s?)+[a-zA-Z0-9]+}",
        r"(Array{[a-zA-Z0-9]+,\s?1}|Vector{[a-zA-Z0-9]+})",
        r"(Array{[a-zA-Z0-9]+,\s?2}|Matrix{[a-zA-Z0-9]+})",
    ]
    Documenter.doctest(TiledIteration, doctestfilters = doctestfilters)

```

does not work.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [October 16, 2020, 6:22am UTC](https://discourse.julialang.org/t/doctests-and-array-printing/48477/4 "2020-10-16T06:22:51Z")

</div>

You can pass them to `makedocs` like that, but it was missed for the `doctest` function ([https://github.com/JuliaDocs/Documenter.jl/issues/1364](https://github.com/JuliaDocs/Documenter.jl/issues/1364)).

Edit: Fixed by [https://github.com/JuliaDocs/Documenter.jl/pull/1435](https://github.com/JuliaDocs/Documenter.jl/pull/1435)
