From: Lars H. <Lar...@re...> - 2008-06-17 22:42:22
|
Andreas Kupries skrev: >> What is currently available /may/ of course be interpreted as "well, >> just copy and modify pop3.test". I suppose this will work (many have >> probably done that) but already the first commmand > >> source [file join \ >> [file dirname [file dirname [file join [pwd] [info script]]]] \ >> devtools testutilities.tcl] > >> there is enough to make me shun away. Surely there should be a better >> way to do this? > > As far as I know, no. This is the standard command to load the common > support code for testsuites in Tcllib. It uses the location of the .test > file to compute the location of the support code and the sourcing it. We > cannot avoid its replication across all testsuites. Stuffing it into a > procedure in the support code will not work, because then you will need the > support code itself to make the support code available. And I do not have > any other ideas. If you have some feel free to tell me. Well, what about a small helper package? One could make the above package require tcllib::testutilities tcllib::testutilities::init or something like that. The separate [tcllib::testutilities::init] call would be needed to retrieve the [info script] data, although now that I think about it, one could (if really devious) embed such a call into the [package ifneeded] script as well. An explicit call does however have the advantage that one can, if necessary, customise the initialisation (no, I don't have a clear use-case for that right now; maybe too tired). What is gained by [package require tcllib::testutilities] is primarily that one avoids hardcoding paths (relative paths, yes, but still hardcoded paths) into the test files. Lars Hellström |