I see. I guess I assumed that a module-level variable would be invariant across the transactions, but clearly not (and I didn’t notice the milliseconds difference).
With a static database value then my tests do pass.
Cheers,
E.
_____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.comhttps://www.servicenow.com LinkedInhttps://www.linkedin.com/company/servicenow | Twitterhttps://twitter.com/servicenow | YouTubehttps://www.youtube.com/user/servicenowinc | Facebookhttps://www.facebook.com/servicenow
From: Christian Grün christian.gruen@gmail.com Date: Tuesday, February 1, 2022 at 12:35 PM To: Eliot Kimber eliot.kimber@servicenow.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Techniques for Unit Testing Updating Operations [External Email]
Hi Eliot,
The database is created but is not dropped and obviously not updated.
If my test is legit then this suggests that before-module and after-module are not separate transactions.
As each function will be evaluated separately, the current dateTime value will be different for each function call. Your code should work if you replace current-dateTime() by current-date() or any other static value.
Best, Christian