Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 38bda69

Browse files
committed
Include object under test in assert messages.
1 parent 72d947f commit 38bda69

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

test/unit/test-hosts.janet

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,76 @@
44
(apply :update ipv4 "127.0.0.1" ["localhost" "localhost.local"])
55

66
(assert (deep= (:hosts ipv4 "127.0.0.1") @["localhost" "localhost.local"])
7-
"Hosts lookup by IP.")
7+
(string/format "Hosts lookup by IP: %q" ipv4))
88

99
(assert (= (:ip ipv4 "localhost") "127.0.0.1")
10-
"IP lookup by host.")
10+
(string/format "IP lookup by host: %q" ipv4))
1111

1212
(assert (= (:hosts ipv4 "0.0.0.0") nil)
13-
"Lookup unknown IP.")
13+
(string/format "Lookup unknown IP: %q" ipv4))
1414

1515
(assert (= (:ip ipv4 "unknown") nil)
16-
"Lookup unknown host.")
16+
(string/format "Lookup unknown host: %q" ipv4))
1717

1818
(:update ipv4 "192.168.1.100" "hostname")
1919

2020
(assert (deep= (:hosts ipv4 "192.168.1.100") @["hostname"])
21-
"Hosts lookup by IP.")
21+
(string/format "Hosts lookup by IP: %q" ipv4))
2222

2323
(assert (= (:ip ipv4 "hostname") "192.168.1.100")
24-
"IP lookup by host.")
24+
(string/format "IP lookup by host: %q" ipv4))
2525

2626
(assert (deep= (:hosts ipv4 "127.0.0.1") @["localhost" "localhost.local"])
27-
"Hosts lookup by IP, after updating unrelated host.")
27+
(string/format "Hosts lookup by IP, after unrelated host: %q" ipv4))
2828

2929
(assert (= (:ip ipv4 "localhost") "127.0.0.1")
30-
"IP lookup by host, after updating unrelated host.")
30+
(string/format "IP lookup by host, after unrelated host: %q" ipv4))
3131

3232
(apply :update ipv4 "127.0.1.1" ["hostname" "localhost.local"])
3333

3434
(assert (deep= (:hosts ipv4 "127.0.1.1")
3535
@["hostname" "localhost" "localhost.local"])
36-
"Hosts lookup by IP, after updating via alias.")
36+
(string/format "Hosts lookup by IP, after alias update: %q" ipv4))
3737

3838
(assert (= (:ip ipv4 "localhost") "127.0.1.1")
39-
"IP lookup by host, after updating via alias.")
39+
(string/format "IP lookup by host, after alias update: %q" ipv4))
4040

4141
(assert (= (:hosts ipv4 "127.0.0.1") nil)
42-
"Hosts lookup by original IP, after updating via alias."))
42+
(string/format "Hosts lookup by old IP, after update: %q" ipv4)))
4343

4444
(let [int-tracker (tracker)]
4545
(assert (= (:seen? int-tracker 7) false)
46-
"Checking a not-yet-seen value.")
46+
(string/format "Checking a not-yet-seen value: %q" int-tracker))
4747

4848
(:see int-tracker 7)
4949

5050
(assert (= (:seen? int-tracker 7) true)
51-
"Checking a seen value.")
51+
(string/format "Checking a seen value: %q" int-tracker))
5252

5353
(assert (= (:seen? int-tracker 42) false)
54-
"Checking an unrelated value."))
54+
(string/format "Checking an unrelated value: %q" int-tracker)))
5555

5656
(let [table-tracker (tracker hash)
5757
a-table @{7 "seven"}]
5858
(assert (= (:seen? table-tracker a-table) false)
59-
"Checking a not-yet-seen value.")
59+
(string/format "Checking a not-yet-seen value: %q" table-tracker))
6060

6161
(:see table-tracker a-table)
6262

6363
(assert (= (:seen? table-tracker a-table) true)
64-
"Checking a seen value.")
64+
(string/format "Checking a seen value: %q" table-tracker))
6565

6666
(assert (= (:seen? table-tracker @{42 "forty-two" 7 "seven"}) false)
67-
"Checking an unrelated value."))
67+
(string/format "Checking an unrelated value: %q" table-tracker)))
6868

6969
(let [custom-tracker (tracker (fn [xs] (string/join xs "|")))]
7070
(assert (= (:seen? custom-tracker @["hello" "world"]) false)
71-
"Checking a not-yet-seen value.")
71+
(string/format "Checking a not-yet-seen value: %q" custom-tracker))
7272

7373
(:see custom-tracker @["hello" "world"])
7474

7575
(assert (= (:seen? custom-tracker @["hello" "world"]) true)
76-
"Checking a seen value.")
76+
(string/format "Checking a seen value: %q" custom-tracker))
7777

7878
(assert (= (:seen? custom-tracker @["hello"]) false)
79-
"Checking an unrelated value."))
79+
(string/format "Checking an unrelated value: %q" custom-tracker)))

0 commit comments

Comments
 (0)