Andy Chambers wrote:
Hi All,
I've just come across some unintuitive behavior in trc that maybe you're interested in.
I was writing the following unit-test for openair and the (check (search "status" ...) was failing, even though the trc just above it showed that "status" was clearly in the output.
Turns out, when you just (princ (update chkbx)), the value that appears is "STATUS" (which is what I should have been testing for anyway). It was just baffling though to have trc tell me that the strings should match, but when the test actually runs, they don't. I think this is because I still don't understand properly how print and friends work.
(deftest test-updates () (cells-reset) (princ #\Newline) (let* ((app (mk-web-app (:prefix "/app")
(make-instance 'md-name-test :fm-parent *parent*))) (page (car (resource app))) (chkbx (fm-other :status :starting page))) (declare (ignorable app page chkbx)) (check (search "value='off'" (xhtml chkbx))) (add-post app "STATUS" "on") (check (search "value='on'" (xhtml chkbx))) (trc "upd" (update chkbx)) (check (search "status" (update chkbx))) (check (search "value=\\'on\\'" (update chkbx)))))
I do not quite follow /exactly/ what you are observing, but I suspect case-sensitivity might be an issue, search by default being case-sensitive. One thing that gets me from time to time is that TRC downcases its output, quite confusing when the case of the output matters. :) ie, I go debugging why something is lowercase and find out it is not. :(
So should that be (search "STATUS... or (search ... :test 'string-equal)?
hth, kt