Lars Balker Rasmussen (via RT) <[EMAIL PROTECTED]> writes:
> # New Ticket Created by  Lars Balker Rasmussen 
> # Please include the string:  [perl #23025]
> # in the subject line of all future correspondence about this issue. 
> # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23025 >
>
>
> There's no reason to test for the presence of setenv/unsetenv in libc
> - these functions are emulated if not present.
>
> However, now the 4th test fails on Solaris (and most likely other OS's
> witout setenv/unsetenv).  This is because the test relies on a key
> disappearing from %ENV when it's been unsetenv'ed - this doesn't
> happen when using putenv("key=") as the current unsetenv emulation.
>
> I'm not sure what's the best portable way to handle this is.

We'll postpone deciding on this one until later - I've attached a
patch to env.t that tests the env-implementation on all platforms, and
doesn't fail on Solaris.

? env.diff
Index: t/pmc/env.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/env.t,v
retrieving revision 1.4
diff -u -a -u -r1.4 env.t
--- t/pmc/env.t	23 Jul 2003 18:18:56 -0000	1.4
+++ t/pmc/env.t	8 Aug 2003 15:42:06 -0000
@@ -1,10 +1,9 @@
 #! perl -w
 
-use Parrot::Test tests => 4;
+use Parrot::Test tests => 5;
 use Test::More;
 use Parrot::Config;
-SKIP: {
-    skip("no setenv", 3) unless $PConfig{"setenv"};
+
 $ENV{"PARROT_TMP"} = "riding a ponie";
 output_like(<<'CODE', <<OUT, "getenv");
     new P0, .Env
@@ -40,10 +39,30 @@
 CODE
 ok
 OUT
-}
+
+output_is(<<'CODE', <<OUT, "gone/delete");
+    new P0, .Env
+    set P0["PARROT_TMP"], "hello polly"
+    exists I0, P0["PARROT_TMP"]
+    if I0, ok1
+    print "not "
+ok1:
+    print "ok 1\n"
+    delete P0["PARROT_TMP"]
+    set S0, P0["PARROT_TMP"]
+    unless S0, ok2
+    print "not "
+ok2:
+    print "ok 2\n"
+    end
+CODE
+ok 1
+ok 2
+OUT
 
 SKIP: {
-    skip("no unsetenv", 1) unless $PConfig{"unsetenv"};
+    # won't work on our unsetenv implementation
+    skip("no native unsetenv", 1) unless $PConfig{"unsetenv"};
 output_is(<<'CODE', <<OUT, "exists/delete");
     new P0, .Env
     set P0["PARROT_TMP"], "hello polly"
-- 
Lars Balker Rasmussen                                      Consult::Perl

Reply via email to