imcc/t/syn/file.t: has a qx() use 2>&1, and later an (unnecessary) qx() using
single quotes, neither of which the windows 98 shell supports.
classes/env.pmc: used getenv() when it should use Parrot_getenv()
t/pmc/env.t: parrot can't change or delete the PARROT_TMP that this sets so
tests 3, 5, and 6 were failing - added a delete $ENV{"PARROT_TMP"} after test 2
__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools
--- imcc/t/syn/file.t~ Tue Feb 17 01:38:00 2004
+++ imcc/t/syn/file.t Wed Feb 25 17:54:08 2004
@@ -8,7 +8,7 @@
=head1 SYNOPSIS
-A test script which is suppossed to be called by Test::Harness.
+A test script which is supposed to be called by Test::Harness.
=cut
@@ -23,7 +23,7 @@
my $PERL5 = $PConfig{perl};
##############################
-open FOO, ">temp.pasm" or die "Cant write temp.pasm\n";
+open FOO, ">temp.pasm" or die "Can't write temp.pasm\n";
print FOO <<'ENDF';
.constant BAR 42
ENDF
@@ -45,7 +45,7 @@
unlink "temp.pasm";
##############################
-open FOO, ">temp.imc" or die "Cant write temp.imc\n";
+open FOO, ">temp.imc" or die "Can't write temp.imc\n";
print FOO <<'ENDF';
.const int BAR = 42
ENDF
@@ -67,7 +67,7 @@
unlink "temp.imc";
##############################
-open FOO, ">temp.inc" or die "Cant write temp.inc\n";
+open FOO, ">temp.inc" or die "Can't write temp.inc\n";
print FOO <<'ENDF';
.const int BAR = 42
ENDF
@@ -148,7 +148,7 @@
# test load_bytecode branches and subs
# write sub2
-open FOO, ">temp.imc" or die "Cant write temp.imc\n";
+open FOO, ">temp.imc" or die "Can't write temp.imc\n";
print FOO <<'ENDF';
.pcc_sub _sub2 prototyped
print "sub2\n"
@@ -179,7 +179,7 @@
OUT
# write sub2
-open FOO, ">temp.imc" or die "Cant write temp.imc\n";
+open FOO, ">temp.imc" or die "Can't write temp.imc\n";
print FOO <<'ENDF';
.pcc_sub _sub2 prototyped
print "sub2\n"
@@ -214,7 +214,7 @@
OUT
# write sub2
-open FOO, ">temp.imc" or die "Cant write temp.imc\n";
+open FOO, ">temp.imc" or die "Can't write temp.imc\n";
print FOO <<'ENDF';
.pcc_sub _not_sub2 prototyped
print "not sub2\n"
@@ -250,7 +250,7 @@
OUT
# write sub2
-open FOO, ">temp.imc" or die "Cant write temp.imc\n";
+open FOO, ">temp.imc" or die "Can't write temp.imc\n";
print FOO <<'ENDF';
.pcc_sub _sub2 prototyped
print "sub2\n"
@@ -308,7 +308,7 @@
OUT
# write subs
-open FOO, ">temp.imc" or die "Cant write temp.imc\n";
+open FOO, ">temp.imc" or die "Can't write temp.imc\n";
print FOO <<'ENDF';
.pcc_sub _sub1 prototyped
print "sub1\n"
@@ -344,7 +344,7 @@
# include a non-existent file and catch the error message
my $err_msg;
{
- open FOO, ">temp.imc" or die "Cant write temp.imc\n";
+ open FOO, ">temp.imc" or die "Can't write temp.imc\n";
print FOO << 'END_PIR';
# Including a non-existent file should produce an error
.include "non_existent.imc"
@@ -355,14 +355,22 @@
.end
END_PIR
close FOO;
- $err_msg = qx{$PARROT temp.imc 2>&1}
+ open OLDERR, ">&STDERR" or die "Can't save STDERR\n";
+ open STDERR, ">temp.out" or die "Can't write temp.out\n";
+ system "$PARROT temp.imc";
+ open FOO, "<temp.out" or die "Can't read temp.out\n";
+ { local $/; $err_msg = <FOO>; }
+ close FOO;
+ open STDERR, ">&OLDERR" or die "Can't restore STDERR\n";
+ unlink "temp.out";
}
# read a non-existent file and catch the error message
my $enoent_err_msg;
{
- my $ENOENT = qx{$PERL5 -e 'open FOO, "<non_existent.file"; print( \$! + 0 )'};
- open FOO, ">temp.imc" or die "Cant write temp.imc\n";
+ open FOO, "<non_existent.file";
+ my $ENOENT = $! + 0;
+ open FOO, ">temp.imc" or die "Can't write temp.imc\n";
print FOO << "END_PIR";
.sub _main
# run a OS command, and get the errmessge for the exit code
--- classes/env.pmc~ Sun Feb 22 09:48:42 2004
+++ classes/env.pmc Wed Feb 25 18:12:16 2004
@@ -39,14 +39,14 @@
int free_it = 0;
STRING *retval;
char *val = NULL;
-
+
if (keyname) {
val = Parrot_getenv(keyname, &free_it);
string_cstring_free(keyname);
if (val) {
- retval = string_from_cstring(interpreter, val, 0);
+ retval = string_from_cstring(interpreter, val, 0);
} else {
- retval = string_from_cstring(interpreter, "", 0);
+ retval = string_from_cstring(interpreter, "", 0);
}
} else {
retval = string_from_cstring(interpreter, "", 0);
@@ -67,7 +67,7 @@
void set_string_keyed(PMC* key, STRING* value) {
char *keyname = string_to_cstring(interpreter,
- VTABLE_get_string(interpreter, key));
+ VTABLE_get_string(interpreter, key));
char *env_val = string_to_cstring(interpreter, value);
if (keyname && env_val) {
Parrot_setenv(keyname, env_val);
@@ -91,20 +91,20 @@
*/
INTVAL exists_keyed(PMC* key) {
- char *keyname = string_to_cstring(interpreter,
- VTABLE_get_string(interpreter, key));
- int free_it;
-
- if (keyname) {
- char *val = Parrot_getenv(keyname, &free_it);
- string_cstring_free(keyname);
- if (val) {
- if (free_it) mem_sys_free(val);
- return 1;
- }
- }
+ char *keyname = string_to_cstring(interpreter,
+ VTABLE_get_string(interpreter, key));
+ int free_it;
- return 0;
+ if (keyname) {
+ char *val = Parrot_getenv(keyname, &free_it);
+ string_cstring_free(keyname);
+ if (val) {
+ if (free_it) mem_sys_free(val);
+ return 1;
+ }
+ }
+
+ return 0;
}
/*
@@ -119,17 +119,19 @@
void delete_keyed(PMC* key) {
char *keyname = string_to_cstring(interpreter,
- VTABLE_get_string(interpreter, key));
-
+ VTABLE_get_string(interpreter, key));
+ int free_it;
+
if (keyname) {
- char *val = getenv(keyname);
+ char *val = Parrot_getenv(keyname, &free_it);
if (val) {
+ if (free_it) mem_sys_free(val);
Parrot_unsetenv(keyname);
}
- string_cstring_free(keyname);
- }
+ string_cstring_free(keyname);
}
}
+}
/*
--- t/pmc/env.t~ Sun Feb 22 14:55:30 2004
+++ t/pmc/env.t Wed Feb 25 18:22:50 2004
@@ -10,7 +10,7 @@
% perl t/pmc/env.t
-=head1 DECSRIPTION
+=head1 DESCRIPTION
Tests the C<Env> PMC.
@@ -42,6 +42,7 @@
/riding a ponie/i
OUT
+delete $ENV{"PARROT_TMP"};
output_like(<<'CODE', <<OUT, "setenv/getenv");
new P0, .Env
set P0["PARROT_TMP"], "hello polly"