Skip to content

Commit

Permalink
wip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenpi committed Sep 8, 2023
1 parent c8e8d3a commit 06f4667
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Binary file added test/examples/images/big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/examples/images/tiny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions test/examples/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ module AutoDocs
end
end

struct MIMEBytes{M <: MIME}
bytes :: Vector{UInt8}
MIMEBytes(mime::AbstractString, bytes::AbstractVector{UInt8}) = new{MIME{Symbol(mime)}}(bytes)
end
Base.show(io::IO, ::M, obj::MIMEBytes{M}) where {M <: MIME} = write(io, obj.bytes)

const BIGPNG = MIMEBytes("image/png", read(joinpath(@__DIR__, "images", "big.png")))
const TINYPNG = MIMEBytes("image/png", read(joinpath(@__DIR__, "images", "tiny.png")))

# Helper functions
function withassets(f, assets...)
src(asset) = joinpath(@__DIR__, asset)
Expand Down
9 changes: 9 additions & 0 deletions test/examples/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,3 +655,12 @@ They do not get evaluated.
!!! ukw "Unknown admonition class"
Admonition with an unknown admonition class.
## Example outputs to file
```@example
Main.BIGPNG
```
```@example
Main.TINYPNG
```
4 changes: 2 additions & 2 deletions test/examples/src/man/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ SVG("""
Large inline SVG to exceed size threashold.

```@example inlinesvg
jlcolors = download(https://raw.githubusercontent.com/JuliaLang/julia-logo-graphics/master/images/julia-colors.svg)
open(io->read(io, String), jlcolors) |> SVG
# jlcolors = download(https://raw.githubusercontent.com/JuliaLang/julia-logo-graphics/master/images/julia-colors.svg)
# open(io->read(io, String), jlcolors) |> SVG
```

_Note: we can't define the `show` method in the `@example` block due to the world age
Expand Down

0 comments on commit 06f4667

Please sign in to comment.