# How to send a string to be read by the REPL?

**URL:** <https://discourse.julialang.org/t/how-to-send-a-string-to-be-read-by-the-repl/13588>\
**Category:** General Usage\
**Created:** [August 16, 2018, 9:17pm UTC](https://discourse.julialang.org/t/how-to-send-a-string-to-be-read-by-the-repl/13588 "2018-08-16T21:17:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [August 16, 2018, 9:17pm UTC](https://discourse.julialang.org/t/how-to-send-a-string-to-be-read-by-the-repl/13588/1 "2018-08-16T21:17:32Z")

</div>

I’m trying to write tests for some code which creates a REPL mode and having a lot of trouble. to test the code I’d like to have a function that allows me to send a string to `Base.active_repl` and then returns the string that the REPL would normally print as the output. ie.

```julia
send_to_repl!(';')
send_to_repl("echo hi") == "hi"

```

is there any way to do this?

---

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [August 16, 2018, 9:31pm UTC](https://discourse.julialang.org/t/how-to-send-a-string-to-be-read-by-the-repl/13588/2 "2018-08-16T21:31:22Z")

</div>

The [tests](https://github.com/JuliaLang/julia/blob/27c7790c06abfb4884617f8eaaebb0cc0fcd204e/stdlib/REPL/test/repl.jl#L73) in REPL do something a bit like that, but it doesn’t look straightforward.

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [August 16, 2018, 9:53pm UTC](https://discourse.julialang.org/t/how-to-send-a-string-to-be-read-by-the-repl/13588/3 "2018-08-16T21:53:29Z")

</div>

That seems to be all about creating a dummy repl and doing tests on it. I would like to access the actual active repl if possible.
