about summary refs log tree commit diff
path: root/test/pronouns/pages_test.clj
blob: 7563be100c2ca6d4da72962215bc20bca0332376 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(ns pronouns.pages-test
  (:require [pronouns.pages :as pages]
            [clojure.test :refer [deftest testing is are]]))

(deftest prose-comma-list
  (testing "`prose-comma-list` turns a list of strings into a prose list"
    (are [v s] (= (pages/prose-comma-list v) s)
      ["foo" "bar" "baz" "bobble"] "foo, bar, baz, and bobble"
      ["foo" "bar" "baz"]          "foo, bar, and baz"
      ["foo" "bar"]                "foo and bar"
      ["foo"]                      "foo"
      []                           "")))

(deftest lookup-pronouns
  (are [pronoun-strs pronouns]
      (= (pages/lookup-pronouns pronoun-strs)
         pronouns)
    ["she/her"]           '(["she" "her" "her" "hers" "herself"])
    ["she" "they"]        '(["she" "her" "her" "hers" "herself"]
                            ["they" "them" "their" "theirs" "themselves"])
    ["she/her" "foo/bar"] '(["she" "her" "her" "hers" "herself"])
    ["foo/bar"]           '()
    ["a/b/c/d/e"]         '(("a" "b" "c" "d" "e"))))