Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make clipboard(g) work #121

Merged
merged 1 commit into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SimpleGraphs/SimpleGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ An abstract type representing a simple graph structure.
"""
abstract type AbstractSimpleGraph{T<:Integer} <: AbstractGraph{T} end

function show(io::IO, g::AbstractSimpleGraph{T}) where T
function show(io::IO, ::MIME"text/plain", g::AbstractSimpleGraph{T}) where T
dir = is_directed(g) ? "directed" : "undirected"
print(io, "{$(nv(g)), $(ne(g))} $dir simple $T graph")
end
Expand Down
10 changes: 6 additions & 4 deletions test/simplegraphs/simplegraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ import Random
gx = SimpleGraph()
for g in testgraphs(gx)
T = eltype(g)
@test sprint(show, g) == "{0, 0} undirected simple $T graph"
@test repr("text/plain", g) == "{0, 0} undirected simple $T graph"
@test @inferred(add_vertices!(g, 5) == 5)
@test sprint(show, g) == "{5, 0} undirected simple $T graph"
@test repr("text/plain", g) == "{5, 0} undirected simple $T graph"
@test eval(Meta.parse(repr(g))) == g
end
gx = SimpleDiGraph()
for g in testdigraphs(gx)
T = eltype(g)
@test sprint(show, g) == "{0, 0} directed simple $T graph"
@test repr("text/plain", g) == "{0, 0} directed simple $T graph"
@test @inferred(add_vertices!(g, 5) == 5)
@test sprint(show, g) == "{5, 0} directed simple $T graph"
@test repr("text/plain", g) == "{5, 0} directed simple $T graph"
@test eval(Meta.parse(repr(g))) == g
end

gx = path_graph(4)
Expand Down