Skip to content
Browse files

Fix several issues found by linting core.logic

+ Several misplaced doc strings.

+ Several deftest names that were identical in the same namespace,
  causing the earlier one's tests never to be run.

+ Some missing (is ...) wrappers around unit tests (caught by linter
  because the first one's return value was discarded).
  • Loading branch information...
1 parent dba36dd commit 5bf5147afdb0fe04da658c3573ca63a922975d05 @jafingerhut jafingerhut committed with swannodette Dec 16, 2013
View
6 src/main/clojure/cljs/core/logic/macros.clj
@@ -112,14 +112,16 @@
;; =============================================================================
;; Debugging
-(defmacro log [& s]
+(defmacro log
"Goal for println"
+ [& s]
`(fn [a#]
(println ~@s)
a#))
-(defmacro trace-s []
+(defmacro trace-s
"Goal that prints the current substitution"
+ []
`(fn [a#]
(println (str a#))
a#))
View
6 src/main/clojure/clojure/core/logic.clj
@@ -1248,14 +1248,16 @@
;; =============================================================================
;; Debugging
-(defmacro log [& s]
+(defmacro log
"Goal for println"
+ [& s]
`(fn [a#]
(println ~@s)
a#))
-(defmacro trace-s []
+(defmacro trace-s
"Goal that prints the current substitution"
+ []
`(fn [a#]
(println (str a#))
a#))
View
15 src/main/clojure/clojure/core/logic/arithmetic.clj
@@ -3,42 +3,47 @@
(:use [clojure.core.logic.protocols]
[clojure.core.logic]))
-(defmacro = [x y]
+(defmacro =
"Goal for testing whether x and y are equal. Non-relational."
+ [x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
(if (clojure.core/= wx# wy# )
a# nil))))
-(defmacro > [x y]
+(defmacro >
"Goal for testing whether x is greater than y. Non-relational."
+ [x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
(if (clojure.core/> wx# wy# )
a# nil))))
-(defmacro >= [x y]
+(defmacro >=
"Goal for testing whether x is greater than or equal to y.
Non-relational."
+ [x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
(if (clojure.core/>= wx# wy# )
a# nil))))
-(defmacro < [x y]
+(defmacro <
"Goal for testing whether x is less than y. Non-relational."
+ [x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
(if (clojure.core/< wx# wy# )
a# nil))))
-(defmacro <= [x y]
+(defmacro <=
"Goal for testing whether x is less than or equal to y.
Non-relational."
+ [x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
View
12 src/test/clojure/clojure/core/logic/tests.clj
@@ -2200,7 +2200,7 @@
s ((fd/process-dom x (fd/interval 1 10) (fd/interval 1 10)) empty-s)]
(is (= (fd/get-dom s x) (fd/interval 1 10)))))
-(deftest test-dom-1
+(deftest test-process-dom-3
(let [x (lvar 'x)
s ((fd/dom x (fd/interval 1 10)) empty-s)]
(is (= (fd/get-dom s x) (fd/interval 1 10)))))
@@ -2446,7 +2446,7 @@
(is (fd/-difference (fd/interval 1 10) 1)
(fd/interval 2 10)))
-(deftest test-boundary-interval-1
+(deftest test-boundary-interval-2
(is (fd/-difference (fd/interval 1 10) 10)
(fd/interval 1 9)))
@@ -2584,7 +2584,7 @@
(== q [x y z]))))
(into #{} '([1 2 3] [1 3 2] [2 1 3] [2 3 1] [3 1 2] [3 2 1])))))
-(deftest test-=fd-1
+(deftest test-=fd-2
(is (= (into #{}
(run* [q]
(fresh [a b]
@@ -3422,7 +3422,7 @@
(is (= (get-attr s x :foo) 'bar))
(is (= (get-attr s x :baz) 'woz))))
-(deftest test-attrs-2 []
+(deftest test-attrs-3 []
(let [x (lvar 'x)
s (ext-no-check empty-s x 1)
s (add-attr s x :foo 'bar)
@@ -3433,8 +3433,8 @@
(deftest test-root-1 []
(let [x (lvar 'x)
s (ext-no-check empty-s x 1)]
- (= (root-var s x) x)
- (= (root-val s x) 1)))
+ (is (= (root-var s x) x))
+ (is (= (root-val s x) 1))))
(deftest test-root-2 []
(let [x (lvar 'x)

0 comments on commit 5bf5147

Please sign in to comment.
Something went wrong with that request. Please try again.