Author: particle
Date: Thu Mar 16 10:16:52 2006
New Revision: 11911
Modified:
trunk/runtime/parrot/library/File/Spec.pir
trunk/src/pmc/none.pmc
trunk/t/library/getopt_obj.t
trunk/t/pmc/hash.t
trunk/t/pmc/none.t
Log:
pmc: modify get_string method of .None PMC to return empty string
~ test suite and library files modified
Modified: trunk/runtime/parrot/library/File/Spec.pir
==============================================================================
--- trunk/runtime/parrot/library/File/Spec.pir (original)
+++ trunk/runtime/parrot/library/File/Spec.pir Thu Mar 16 10:16:52 2006
@@ -123,8 +123,7 @@
.local string module
module= modules[ osname ]
- ## FIXME: when undef doesn't return 'None' in scalar context
- ne 'None', module, found_module
+ ne '', module, found_module
module= 'Unix'
found_module:
Modified: trunk/src/pmc/none.pmc
==============================================================================
--- trunk/src/pmc/none.pmc (original)
+++ trunk/src/pmc/none.pmc Thu Mar 16 10:16:52 2006
@@ -57,7 +57,7 @@
}
STRING* get_string () {
- return SELF->vtable->whoami;
+ return string_make_empty(INTERP,enum_stringrep_one,0);
}
INTVAL get_bool () {
Modified: trunk/t/library/getopt_obj.t
==============================================================================
--- trunk/t/library/getopt_obj.t (original)
+++ trunk/t/library/getopt_obj.t Thu Mar 16 10:16:52 2006
@@ -344,7 +344,7 @@
print $S0
print "\n"
- # Hash sets an nonexistant value to None
+ # Hash sets an nonexistant value to ''
$S0 = $P1["bar"]
print "bar is "
print $S0
@@ -358,7 +358,7 @@
.end
CODE
foo is 1
-bar is None
+bar is
argv[0] is --bar
OUT
@@ -406,7 +406,7 @@
.end
CODE
foo is 1
-bar is None
+bar is
argv[0] is foo
argv[1] is --bar
OUT
Modified: trunk/t/pmc/hash.t
==============================================================================
--- trunk/t/pmc/hash.t (original)
+++ trunk/t/pmc/hash.t Thu Mar 16 10:16:52 2006
@@ -639,7 +639,7 @@
print "not "
OK2: print "ok 2\n"
- eq S0, "None", OK3
+ eq S0, "", OK3
print "not "
OK3: print "ok 3\n"
Modified: trunk/t/pmc/none.t
==============================================================================
--- trunk/t/pmc/none.t (original)
+++ trunk/t/pmc/none.t Thu Mar 16 10:16:52 2006
@@ -26,13 +26,24 @@
pir_output_is(<<'CODE', <<'OUT', 'new');
.sub 'test' :main
- new P0, .None
- print "ok 1\n"
+ new P0, .None
+ print "ok 1\n"
.end
CODE
ok 1
OUT
+pir_output_is(<<'CODE', <<'OUT', 'get_string returns ""');
+.sub 'test' :main
+ new P0, .None
+ S0 = P0
+ eq S0, '', OK
+NOK:print "not "
+OK: print "ok\n"
+.end
+CODE
+ok
+OUT
# remember to change the number of tests :-)
-BEGIN { plan tests => 1; }
+BEGIN { plan tests => 2; }