<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged stdin</title>
<link>https://ask.clojure.org/index.php/tag/stdin</link>
<description></description>
<item>
<title>How to read json input in stdin ?</title>
<link>https://ask.clojure.org/index.php/8612/how-to-read-json-input-in-stdin</link>
<description>&lt;p&gt;I need to read json line input in stdin&lt;/p&gt;
&lt;p&gt;Example INPUT&lt;/p&gt;
&lt;p&gt;{ &quot;foo&quot; : &quot;bar&quot; }&lt;/p&gt;
&lt;p&gt;{ &quot;foo&quot; : &quot;bar&quot; }&lt;/p&gt;
</description>
<category>IO</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8612/how-to-read-json-input-in-stdin</guid>
<pubDate>Tue, 17 Sep 2019 12:49:04 +0000</pubDate>
</item>
<item>
<title>Testing the -main function who reads from *in*</title>
<link>https://ask.clojure.org/index.php/8467/testing-the-main-function-who-reads-from-in</link>
<description>&lt;p&gt;My &lt;code&gt;-main&lt;/code&gt; function reads arguments from &lt;code&gt;*in*&lt;/code&gt;, like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn -main
  [&amp;amp; args]
  (doseq [ln (line-seq (java.io.BufferedReader. *in*))]
  ; Do something...
))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I use my app basically like: &lt;code&gt;$ lein run &amp;lt; input.txt&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I would like to test this function but I don't know how I would write a test case that simulates the stdin passing data to my &lt;code&gt;-main&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
</description>
<category>Test</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8467/testing-the-main-function-who-reads-from-in</guid>
<pubDate>Tue, 27 Aug 2019 12:45:38 +0000</pubDate>
</item>
</channel>
</rss>