[svn:parrot] r47432 - in trunk: src/string t/op

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Jun 6 23:02:17 UTC 2010


Author: bacek
Date: Sun Jun  6 23:02:16 2010
New Revision: 47432
URL: https://trac.parrot.org/parrot/changeset/47432

Log:
Fix numification of short strings. Closes #1674

Modified:
   trunk/src/string/api.c
   trunk/t/op/string.t

Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c	Sun Jun  6 22:57:45 2010	(r47431)
+++ trunk/src/string/api.c	Sun Jun  6 23:02:16 2010	(r47432)
@@ -2081,8 +2081,6 @@
         else if (Parrot_str_equal(interp, t, CONST_STRING(interp, "-INF"))
              ||  Parrot_str_equal(interp, t, CONST_STRING(interp, "-INFINITY")))
             return PARROT_FLOATVAL_INF_NEGATIVE;
-        else
-            return 0.0;
     }
 
 /* powl() could be used here, but it is an optional POSIX extension that

Modified: trunk/t/op/string.t
==============================================================================
--- trunk/t/op/string.t	Sun Jun  6 22:57:45 2010	(r47431)
+++ trunk/t/op/string.t	Sun Jun  6 23:02:16 2010	(r47432)
@@ -19,8 +19,6 @@
 .sub main :main
     .include 'test_more.pir'
 
-    plan(284)
-
     set_s_s_sc()
     test_clone()
     clone_null()
@@ -108,6 +106,7 @@
     index_multibyte_matching_two()
     num_to_string()
     string_to_int()
+    string_to_num()
     concat_or_substr_cow()
     constant_to_cstring()
     cow_with_chopn_leaving_original_untouched()
@@ -148,6 +147,7 @@
     # END_OF_TESTS
     join_get_string_returns_a_null_string()
 
+    done_testing()
 .end
 
 .macro exception_is ( M )
@@ -1069,6 +1069,16 @@
     is( $I0, "0", 'string to int' )
 .end
 
+.sub string_to_num
+    set $S0, "6foo"
+    set $N0, $S0
+    is( $N0, "6", '6foo to num' )
+
+    set $S0, "16foo"
+    set $N0, $S0
+    is( $N0, "16", '16foo to num' )
+.end
+
 .sub concat_or_substr_cow
     set $S0, "<JA"
     set $S1, "PH>"


More information about the parrot-commits mailing list