Re: can the :test metadata be used to constrain the range of a variable?

2010-02-19 Thread Stuart Sierra
On Feb 17, 6:26 am, Timothy Pratley timothyprat...@gmail.com wrote: :test can be used to store a unit test (typically for a function) but you should use clojure.test for writing unit tests, just ignore :test clojure.test uses :test metadata, so it is somewhat compatible. -SS -- You received

can the :test metadata be used to constrain the range of a variable?

2010-02-17 Thread metaperl
I tried to use :test to constrain the range of a variable, but it didnt seem to work. Am I misunderstanding the purpose of this keyword? user= (def #^{ :doc Integer between -5 and 5 :test (fn [] (assert (and ( x -5) ( x 5} x 12) #'user/x user= user/x 12 I had hoped this would throw an

Re: can the :test metadata be used to constrain the range of a variable?

2010-02-17 Thread Timothy Pratley
On 17 February 2010 21:53, metaperl scheme...@gmail.com wrote: I tried to use :test to constrain the range of a variable, but it didnt seem to work. Am I misunderstanding the purpose of this keyword? What you want is set-validator! :test can be used to store a unit test (typically for a