Permalink
Browse files

bencode parser tests

  • Loading branch information...
1 parent 62cc2b7 commit ea33d1a870e068dc6baec2ab488d0de36988c56b @youngnh committed Feb 7, 2011
Showing with 7 additions and 3 deletions.
  1. +1 −1 src/parsatron/languages/bencode.clj
  2. +6 −2 test/parsatron/languages/test_bencode.clj
@@ -32,7 +32,7 @@
val (ben-value)]
(always [key val]))]
(between (char \d) (char \e)
- (p-let [entries (many (entry))]
+ (p-let [entries (many entry)]
(always (into {} entries))))))
(defparser ben-value []
@@ -1,6 +1,6 @@
(ns parsatron.languages.test-bencode
(:use [the.parsatron]
- [parsatron.languages.bencode]
+ [parsatron.languages.bencode]
[clojure.test]))
(deftest test-ben-integer
@@ -13,4 +13,8 @@
(deftest test-ben-list
(are [expected input] (= expected (run (ben-list) input))
- [42 "spam"] "li42e4:spame"))
+ [42 "spam"] "li42e4:spame"))
+
+(deftest test-ben-dictionary
+ (are [expected input] (= expected (run (ben-dictionary) input))
+ [{42 "spam", "spam" 42} "di42e4:spam4:spami42ee"]))

0 comments on commit ea33d1a

Please sign in to comment.