[svn:parrot] r48284 - in trunk: src/pmc t/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Aug 3 10:50:19 UTC 2010


Author: NotFound
Date: Tue Aug  3 10:50:18 2010
New Revision: 48284
URL: https://trac.parrot.org/parrot/changeset/48284

Log:
some more tests and a bit of reorganization in Capture tests

Modified:
   trunk/src/pmc/capture.pmc
   trunk/t/pmc/capture.t

Modified: trunk/src/pmc/capture.pmc
==============================================================================
--- trunk/src/pmc/capture.pmc	Tue Aug  3 09:33:43 2010	(r48283)
+++ trunk/src/pmc/capture.pmc	Tue Aug  3 10:50:18 2010	(r48284)
@@ -479,9 +479,10 @@
 
         GET_ATTR_hash(INTERP, SELF, hash);
 
-        if (!hash)
+        if (!hash) {
+            /*abort();*/
             return 0.0;
-
+        }
         return VTABLE_get_number_keyed(INTERP, hash, key);
     }
 

Modified: trunk/t/pmc/capture.t
==============================================================================
--- trunk/t/pmc/capture.t	Tue Aug  3 09:33:43 2010	(r48283)
+++ trunk/t/pmc/capture.t	Tue Aug  3 10:50:18 2010	(r48284)
@@ -17,7 +17,7 @@
 
 =cut
 
-.const int TESTS = 51
+.const int TESTS = 53
 
 .sub 'test' :main
     .include 'test_more.pir'
@@ -25,6 +25,7 @@
     plan(TESTS)
 
     test_new_capture()
+    empty_capture_tests()
     basic_capture_tests()
     test_defined_delete_exists()
     test_hash_list()
@@ -41,20 +42,34 @@
     ok(1, 'new Capture')
 .end
 
-.sub 'basic_capture_tests'
+.sub 'empty_capture_tests'
     .local pmc capt
 
     capt = new ['Capture']
 
     $I0 = elements capt
     is($I0, 0, 'elements on empty Capture')
+
     $N0 = capt[0]
-    is($N0, 0, 'get_number_keyed_int on empty Capture')
+    is($N0, 0.0, 'get_number_keyed_int on empty Capture')
     $I0 = capt[0]
     is($I0, 0, 'get_integer_keyed_int on empty Capture')
     $S0 = capt[0]
     is($S0, '', 'get_string_keyed_int on empty Capture')
 
+    $N0 = capt['nothing']
+    is($N0, 0.0, 'get_number_keyed on empty Capture')
+
+    $S0 = capt
+    $S1 = 'get_string on empty Capture - ' . $S0
+    substring($S0, 'Capture[', $S1)
+.end
+
+.sub 'basic_capture_tests'
+    .local pmc capt
+
+    capt = new ['Capture']
+
     capt[0] = 0
     capt[1] = 1.5
     capt[2] = 'two'


More information about the parrot-commits mailing list