From necto.not at gmail.com Sun Mar 18 12:22:03 2012 From: necto.not at gmail.com (necto) Date: Sun, 18 Mar 2012 15:22:03 +0300 Subject: [lift-devel] Multiple values testing for the same code Message-ID: Hello, everyone! I need the following thing: I had a test-suite setted up for some value (class-instance). Now there are anothe value with the same properties, and I want it to be tested in the same test-suite. Workaround looks very ugly: (deftestsuite percl-db-test (percl-test) ((*db* (make-instance 'tst-mem-db))) (addtest (percl-db-test) store ...) (addtest (percl-db-test) load ...) ;..... (deftestsuite percl-db-test (percl-test) ((*db* (make-instance 'tst-sql-db))) (addtest (percl-db-test) store ...) (addtest (percl-db-test) load ...) Is there any way to do it smart? Regards, Necto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwking at metabang.com Sun Mar 18 14:00:30 2012 From: gwking at metabang.com (Gary King) Date: Sun, 18 Mar 2012 10:00:30 -0400 Subject: [lift-devel] Multiple values testing for the same code In-Reply-To: References: Message-ID: <6BD2BAF6-D04A-468F-BC33-B70EAB81B4AC@metabang.com> Hi Necto, There isn't a super beautiful way to do this in LIFT (at least, not that I've come up with!). Two things come to mind: 1. make a test-suite like (deftestsuite percl-db-test (percl-test) (db-class *db*) (:setup (setf *db* (make-instance db-class))) (addtest (percl-db-test) store ...) (addtest (percl-db-test) load ...) then make a new test suite (deftestsuite percl-db-test-runner (percl-test) ()) (addtest (percl-db-test-runner) test-mem-db (let ((*test-result* (run-tests :suite 'percl-db-test :testsuite-initargs '(:db-class 'mem-db)) -- make sure there were no failures and errors -- )) There are examples like this in the LIFT test-suite 2. use ensure-cases (deftestsuite percl-db-test (percl-test) ()) (addtest (percl-db-test) store (ensure-cases (class) '(mem-db sql-db) (let ((*db* (make-instance class))) ...)) Using a macro to handle the boilerplate for the second idea will make it look fairly elegant :-) HTH, On Mar 18, 2012, at 8:22 AM, necto wrote: > Hello, everyone! > > I need the following thing: > I had a test-suite setted up for some value (class-instance). Now there are anothe value with the same properties, and I want it to be tested in the same test-suite. Workaround looks very ugly: > > (deftestsuite percl-db-test (percl-test) > ((*db* (make-instance 'tst-mem-db))) > > (addtest (percl-db-test) store ...) > (addtest (percl-db-test) load ...) > > ;..... > > (deftestsuite percl-db-test (percl-test) > ((*db* (make-instance 'tst-sql-db))) > > (addtest (percl-db-test) store ...) > (addtest (percl-db-test) load ...) > > Is there any way to do it smart? > > Regards, > Necto. > _______________________________________________ > lift-devel mailing list > lift-devel at common-lisp.net > http://lists.common-lisp.net/cgi-bin/mailman/listinfo/lift-devel -- Gary Warren King, metabang.com Cell: (413) 559 8738 Fax: (206) 338-4052 gwkkwg on Skype * garethsan on AIM * gwking on twitter -------------- next part -------------- An HTML attachment was scrubbed... URL: