# Using jldoctest across Julia versions

**URL:** <https://discourse.julialang.org/t/using-jldoctest-across-julia-versions/57562>\
**Category:** General Usage\
**Tags:** documentation, testing, documenter\
**Created:** [March 19, 2021, 6:46pm UTC](https://discourse.julialang.org/t/using-jldoctest-across-julia-versions/57562 "2021-03-19T18:46:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nben/32/11164_2.png) [@nben](https://discourse.julialang.org/u/nben)\
**Post date:** [March 19, 2021, 6:46pm UTC](https://discourse.julialang.org/t/using-jldoctest-across-julia-versions/57562/1 "2021-03-19T18:46:50Z")

</div>

I am developing a library called [Air](https://github.com/noahbenson/Air.jl) that includes persistent collection types. (I don’t think this context is very important, but the link is included in case it helps.) As part of this I have a large number of `jldoctest`-style tests/examples. However, I can’t make them pass on multiple versions of Julia. Here’s a simple demonstration of why.

In Julia version 1.5.4:

```julia
julia> Vector([1,2,3])
3-element Array{Int64,1}:
 1
 2
 3

```

In Julia 1.6.0 (or nightly):

```julia
julia> Vector([1,2,3])
3-element Vector{Int64}:
 1
 2
 3

```

My tests in the library use custom types `PArray` and `PVector`, but since these tests depend on `Base.show`’s implementation fo `AbstractArray`, the issue is the same as shown here. Note that the first prints `PArray{Int64,1}` while the second prints `PVector{Int64}`. Here’s another example:

1.5.4:

```julia
julia> Dict(:a => 1)
Dict{Symbol,Int64} with 1 entry:
  :a => 1

```

1.6.0:

```julia
julia> Dict(:a => 1)
Dict{Symbol, Int64} with 1 entry:
  :a => 1

```

Notice that in the first example there is no space between the type parameters (`Diict{Symbol,Int64}`) and in the second example there is a space (`Dict{Symbol, Int64}`).

How do I write `jldoctest` blocks that understand that different outputs should be produced depending on the Julia version? Or are these kinds of tests not possible across versions?

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [March 19, 2021, 8:35pm UTC](https://discourse.julialang.org/t/using-jldoctest-across-julia-versions/57562/2 "2021-03-19T20:35:52Z")

</div>

Here’s a previous reply [How to filter out errors due to alias of Type name when building documentation? - #2 by fredrikekre](https://discourse.julialang.org/t/how-to-filter-out-errors-due-to-alias-of-type-name-when-building-documentation/53588/2)
