about summary refs log tree commit diff
path: root/test/pronouns
diff options
context:
space:
mode:
Diffstat (limited to 'test/pronouns')
-rw-r--r--test/pronouns/pages_test.clj16
-rw-r--r--test/pronouns/resource_test.clj12
-rw-r--r--test/pronouns/util_test.clj32
3 files changed, 53 insertions, 7 deletions
diff --git a/test/pronouns/pages_test.clj b/test/pronouns/pages_test.clj
index 04c14ce..e32a2ee 100644
--- a/test/pronouns/pages_test.clj
+++ b/test/pronouns/pages_test.clj
@@ -1,10 +1,12 @@
 (ns pronouns.pages-test
   (:require [pronouns.pages :as pages]
-            [midje.sweet :refer :all]))
+            [clojure.test :refer [deftest testing is are]]))
 
-(fact "prose-comma-list turns a list of strings into a prose list with commas"
-      (pages/prose-comma-list ["foo"]) => "foo"
-      (pages/prose-comma-list ["foo" "bar"]) => "foo and bar"
-      (pages/prose-comma-list ["foo" "bar" "baz"]) => "foo, bar, and baz"
-      (pages/prose-comma-list ["foo" "bar" "baz" "bobble"]) => "foo, bar, baz, and bobble"
-      (pages/prose-comma-list []) => "")
+(deftest prose-comma-list
+  (testing "prose-comma-list turns a list of strings into a prose list"
+    (are [call result] (= call result)
+      (pages/prose-comma-list ["foo"]) "foo"
+      (pages/prose-comma-list ["foo" "bar"]) "foo and bar"
+      (pages/prose-comma-list ["foo" "bar" "baz"]) "foo, bar, and baz"
+      (pages/prose-comma-list ["foo" "bar" "baz" "bobble"]) "foo, bar, baz, and bobble"
+      (pages/prose-comma-list []) "")))
diff --git a/test/pronouns/resource_test.clj b/test/pronouns/resource_test.clj
new file mode 100644
index 0000000..38ee4e3
--- /dev/null
+++ b/test/pronouns/resource_test.clj
@@ -0,0 +1,12 @@
+(ns pronouns.resource-test
+  (:require [pronouns.util :as util]
+            [clojure.test :refer [deftest testing is]]))
+
+(deftest valid-pronouns-table
+  (let [table (util/slurp-tabfile "resources/pronouns.tab")]
+    (is table "pronouns.tab exists and is non-empty")
+    (doseq [row table]
+      (is (= (count row) 5)
+          "row has five elements")
+      (is (re-matches #".*sel(f|ves)$" (last row))
+          "final element is reflexive"))))
diff --git a/test/pronouns/util_test.clj b/test/pronouns/util_test.clj
new file mode 100644
index 0000000..3aecc2a
--- /dev/null
+++ b/test/pronouns/util_test.clj
@@ -0,0 +1,32 @@
+(ns pronouns.util-test
+  (:require [pronouns.util :as util]
+            [clojure.test :refer [deftest testing is are]]))
+
+(def test-table [["ze" "hir" "hir" "hirs" "hirself"]
+                 ["ze" "zir" "zir" "zirs" "zirself"]
+                 ["she" "her" "her" "hers" "herself"]
+                 ["he" "him" "his" "his" "himself"]
+                 ["they" "them" "their" "theirs" "themselves"]
+                 ["they" "them" "their" "theirs" "themself"]])
+
+(deftest table-filters
+  (testing "table-front-filter"
+    (are [arg return] (= (util/table-front-filter arg test-table) return)
+      ["she"] [["she" "her" "her" "hers" "herself"]]
+      ["ze"] [["ze" "hir" "hir" "hirs" "hirself"]
+              ["ze" "zir" "zir" "zirs" "zirself"]]
+      ["ze" "zir"] [["ze" "zir" "zir" "zirs" "zirself"]]))
+
+  (testing "table-end-filter"
+    (are [arg return] (= (util/table-end-filter arg test-table) return)
+      ["themself"] [["they" "them" "their" "theirs" "themself"]]
+      ["themselves"] [["they" "them" "their" "theirs" "themselves"]])))
+
+(deftest table-lookup
+  (are [arg return] (= (util/table-lookup arg test-table) return)
+    ["she"] ["she" "her" "her" "hers" "herself"]
+    ["ze"] ["ze" "hir" "hir" "hirs" "hirself"]
+    ["ze" "zir"] ["ze" "zir" "zir" "zirs" "zirself"]
+    ["they"] ["they" "them" "their" "theirs" "themselves"]
+    ["they" "..." "themself"] ["they" "them" "their" "theirs" "themself"]))
+