Permalink
Browse files

added test and build all script

  • Loading branch information...
1 parent e2b78c0 commit 9fa7589c8cff7c3e4cbc7ab67e2734e9f34e3620 @rn-superg rn-superg committed Sep 8, 2010
Showing with 34 additions and 9 deletions.
  1. +6 −6 README.md
  2. +1 −1 project.clj
  3. +8 −0 rebuild.sh
  4. +19 −2 test/clj_avro/test/core.clj
View
12 README.md
@@ -18,14 +18,14 @@ Basic wrapper for avro functionality. Currently, only supports flat/linear sche
{:name "bob"
:num_likes 1
:num_photos 2
- :num_groups 3}
+ :num_groups 3})
(thaw *some-schema*
- (freeze *some-schema*
- {:name "bob"
- :num_likes 1
- :num_photos 2
- :num_groups 3}))
+ (freeze *some-schema*
+ {:name "bob"
+ :num_likes 1
+ :num_photos 2
+ :num_groups 3}))
## Value Marshalling and Unmarshalling
View
2 project.clj
@@ -1,5 +1,5 @@
(defproject clj-avro "1.0.0"
- :description "FIXME: write"
+ :description "Avro Wrapper for Clojure"
:dev-dependencies [[swank-clojure "1.2.1"]]
:dependencies [[org.clojure/clojure "1.1.0"]
[org.apache.hadoop/avro "1.3.3"]
View
8 rebuild.sh
@@ -0,0 +1,8 @@
+set -eu
+test -f pom.xml && rm pom.xml
+test -f *.jar && rm *.jar
+lein clean
+lein deps
+lein test
+lein jar
+lein pom
View
21 test/clj_avro/test/core.clj
@@ -2,5 +2,22 @@
(:use [clj-avro.core] :reload)
(:use [clojure.test]))
-(deftest replace-me ;; FIXME: write
- (is false "No tests have been written."))
+(def *test-schema*
+ (defschema
+ {:namespace "test.avro",
+ :name "FacebookUser",
+ :type "record",
+ :fields [{:name "name", :type "string"},
+ {:name "num_likes", :type "int"},
+ {:name "num_photos", :type "int"},
+ {:name "num_groups", :type "int"}]}))
+
+
+(deftest test-can-roundtrip
+ (let [data {:name "bob"
+ :num_likes 1
+ :num_photos 2
+ :num_groups 3}]
+ (is (= data (thaw *test-schema* (freeze *test-schema* data))))))
+
+;; (test-can-roundtrip)

0 comments on commit 9fa7589

Please sign in to comment.