Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] sympa[10828] trunk/t/Language.t: [dev] no need to re-add standard @INC, but relative path for src/lib helps executing the tests manually

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Guillaume Rousse <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] [sympa-commits] sympa[10828] trunk/t/Language.t: [dev] no need to re-add standard @INC, but relative path for src/lib helps executing the tests manually
  • Date: Fri, 06 Jun 2014 10:46:31 +0200

Le 06/06/2014 09:10, IKEDA Soji a écrit :
Hi, please tell me...

On Wed, 4 Jun 2014 17:28:26 +0200 (CEST)
address@concealed wrote:

sympa[10828] trunk/t/Language.t: [dev] no need to re-add standard @INC, but
relative path for src/lib helps executing the tests manually
Revision 10828 Author rousse Date 2014-06-04 17:28:25 +0200 (mer. 04 juin
2014)
Log Message[dev] no need to re-add standard @INC, but relative path for
src/lib helps executing the tests manually
Modified Paths
trunk/t/Language.t
Diff
Modified: trunk/t/Language.t (10827 => 10828)
--- trunk/t/Language.t 2014-06-04 13:14:25 UTC (rev 10827)
+++ trunk/t/Language.t 2014-06-04 15:28:25 UTC (rev 10828)
@@ -9,9 +9,12 @@

use strict;
use warnings;
+
+use FindBin qw($Bin);
+use lib 't/stub', "$Bin/../src/lib";
+
use Test::More;

-use lib 't/stub', @INC;
use Sympa::Language;

# Lang 2 gettext locale

@INC was unneccessary. However, I have two questions:

- Is arrangement by FindBin required?

Is it possible that "make check" invokes test scripts from the
other location than the top of source? If it is not, lib list
can simply contain "src/lib".
make check, no. Direct invocation, yes.

- May each test script be executable? I mean that its executable
bit is on and it has sh-bang line.

Sh-bang line fixes path of Perl interpreter. Developer may wish
to test with other Perl executables. I guess the script
itself should not have sh-bang and may not be executable.
If you want to use another interpreter, just call it explicitely, and pass it the test script as an argument. Neither the sh-bang, nor the executable bit prevent you to do it

Additionally, if "make check" gives default module search path
using PERL5LIB enviroment variable, lib list also need not contain
"src/lib".

# n.b. environment variable seems better than -I option,
# because it will propagate to child processes (see LockedFile.t).
Indeed, altough -I flag can also be passed to child process.

Those scripts are currenly self-contained, executable without configuring environment first, while not preventing any override. For the cost of two additional line of code... Why should we remove them, just because there is another way to do it ?
--
Guillaume Rousse
INRIA, Direction des systèmes d'information
Domaine de Voluceau
Rocquencourt - BP 105
78153 Le Chesnay
Tel: 01 39 63 58 31

Attachment: smime.p7s
Description: Signature cryptographique S/MIME




Archive powered by MHonArc 2.6.19+.

Top of Page