Permalink
Browse files

Cleaning up provide tests

  • Loading branch information...
1 parent 005b179 commit 7f8c99a4661ee69666035388f4b2643a474a18f6 @fogus fogus committed Jan 15, 2013
Showing with 7 additions and 14 deletions.
  1. +7 −14 src/test/clojure/clojure/core/provide_tests.clj
View
21 src/test/clojure/clojure/core/provide_tests.clj
@@ -1,30 +1,23 @@
(ns clojure.core.provide-tests
(:use [clojure.test :only (deftest is)]
- [clojure.core.contracts :as contracts]))
+ [clojure.core.contracts :as contract]))
;; # Inline contract syntax
(defn sqr [n]
(* n n))
-(contracts/provide
+(contract/provide
(sqr "The constraining of sqr" [n]
[number? (not= 0 n)
=>
pos? number?]))
-(deftest test-provide
+(deftest test-basic-provide-syntax
(is (= 25 (sqr 5)))
(is (= 25 (sqr -5)))
(is (thrown? AssertionError (sqr 0))))
-(comment
-
- (sqr 0)
-
-)
-
-
;; # Contract name use
(defn sqr2 [n]
@@ -35,10 +28,10 @@
"Defines the constraints on squaring."
[n] [number? (not= 0 n) => pos? number?]))
-(contracts/provide
+(contract/provide
(sqr2 "Apply the contract for squaring" sqr-c))
-(deftest apply-existing-contract-test
+(deftest test-apply-existing-contract-by-name
(is (= 25 (sqr2 5)))
(is (= 25 (sqr2 -5)))
(is (thrown? AssertionError (sqr2 0))))
@@ -49,12 +42,12 @@
([x] (* 2 x))
([x y] (* y x 2)))
-(contracts/provide
+(contract/provide
(times2 "The constraining of times2"
[n] [number? => number? (== % (* 2 n))]
[x y] [(every? number? [x y]) => number? (== % (* x y 2))]))
-(deftest apply-contract-arity2-test
+(deftest test-apply-provide-contract-arity2-syntax
(is (= 10 (times2 5)))
(is (= -10 (times2 -5)))
(is (thrown? AssertionError (times2 :a)))

0 comments on commit 7f8c99a

Please sign in to comment.