# How can I test 3-arg \`show\` methods?\`@test sprint(?, x) == "expected"\`

**URL:** <https://discourse.julialang.org/t/how-can-i-test-3-arg-show-methods-test-sprint-x-expected/55591>\
**Category:** General Usage\
**Created:** [February 19, 2021, 1:03am UTC](https://discourse.julialang.org/t/how-can-i-test-3-arg-show-methods-test-sprint-x-expected/55591 "2021-02-19T01:03:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Post date:** [February 19, 2021, 1:03am UTC](https://discourse.julialang.org/t/how-can-i-test-3-arg-show-methods-test-sprint-x-expected/55591/1 "2021-02-19T01:03:38Z")

</div>

how can I test 3-arg `show` methods?  
`@test sprint(????, x) == "expected"`

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1613696589186200?thread_ts=1613696589.186200&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

**Author:** ![mileslucas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mileslucas/32/11747_2.png) [@mileslucas](https://discourse.julialang.org/u/mileslucas)\
**Post date:** [February 19, 2021, 4:51am UTC](https://discourse.julialang.org/t/how-can-i-test-3-arg-show-methods-test-sprint-x-expected/55591/2 "2021-02-19T04:51:08Z")

</div>

> @fredrikekre  
> You can just pass the mime to sprint:

```julia
julia> sprint(show, MIME("text/plain"), [1, 2, 3])
"3-element Vector{Int64}:\n 1\n 2\n 3"
julia> sprint(show, [1, 2, 3])
"[1, 2, 3]"

```

---

<div class="post-metadata">

**Author:** ![mileslucas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mileslucas/32/11747_2.png) [@mileslucas](https://discourse.julialang.org/u/mileslucas)\
**Post date:** [February 19, 2021, 4:53am UTC](https://discourse.julialang.org/t/how-can-i-test-3-arg-show-methods-test-sprint-x-expected/55591/3 "2021-02-19T04:53:08Z")

</div>

> @giordano  
> I usually use `repr`  
> the first argument to `repr` is the MIME

```julia
julia> repr("text/plain", [1, 2, 3])
"3-element Vector{Int64}:\n 1\n 2\n 3"
julia> repr([1, 2, 3])
"[1, 2, 3]"

```
