Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added a quick test etc

  • Loading branch information...
commit c63384bb0d5a66f9fda938145027529ca7a06027 1 parent 8b85b85
Anthony Snavely authored
Showing with 23 additions and 10 deletions.
  1. +9 −10 src/anthony/dict/dictclient.clj
  2. +14 −0 src/anthony/dict/test/core.clj
19 src/anthony/dict/dictclient.clj
View
@@ -19,7 +19,9 @@
(loop [line (.readLine dict-input)
lines []]
(if (.startsWith line ".")
- lines
+ (do
+ (.readLine dict-input) ; the 250 OK, irrelevant
+ lines)
(recur (.readLine dict-input) (conj lines line)))))
(defn push-command [conn-info command & args]
@@ -66,19 +68,16 @@
(defn match [conn-info db strat word] (push-command conn-info "MATCH" db strat word))
-(defn show-dictionaries [conn-info] (push-command conn-info "SHOW DB" nil))
+(defn show-dictionaries [conn-info] (push-command conn-info "SHOW DB"))
-(defn show-strategies [conn-info] (push-command conn-info "SHOW STRAT" nil))
+(defn show-strategies [conn-info] (push-command conn-info "SHOW STRAT"))
(defn show-info [conn-info database] (push-command conn-info "SHOW INFO" database))
-(defn help [conn-info] (push-command conn-info "HELP" nil))
-
-(defn show-server [conn-info] (push-command conn-info "SHOW SERVER" nil))
+(defn help [conn-info] (push-command conn-info "HELP"))
-(defn status [conn-info] (push-command conn-info "STATUS" nil))
+(defn show-server [conn-info] (push-command conn-info "SHOW SERVER"))
-(defn quit [conn-info] (push-command conn-info "QUIT" nil))
+(defn status [conn-info] (push-command conn-info "STATUS"))
-(let [conn-shit (connect "dict.org" 2628)]
- (println (show-server conn-shit)))
+(defn quit [conn-info] (push-command conn-info "QUIT"))
14 src/anthony/dict/test/core.clj
View
@@ -0,0 +1,14 @@
+(ns anthony.dict.test.core
+ (:require [anthony.dict.dictclient :as dict]))
+
+
+(let [conn-shit (dict/connect "dict.org" 2628)] ; testing etc
+ (println (dict/define conn-shit "wn" "ice"))
+ (println (dict/match conn-shit "*" "exact" "ice"))
+ (println (dict/show-server conn-shit))
+ (println (dict/show-dictionaries conn-shit))
+ (println (dict/show-strategies conn-shit))
+ (println (dict/show-info conn-shit "wn"))
+ (println (dict/help conn-shit))
+ (println (dict/status conn-shit))
+ (println (dict/quit conn-shit)))
Please sign in to comment.
Something went wrong with that request. Please try again.