[svn:parrot] r47068 - trunk/t/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu May 27 22:14:37 UTC 2010


Author: NotFound
Date: Thu May 27 22:14:36 2010
New Revision: 47068
URL: https://trac.parrot.org/parrot/changeset/47068

Log:
tests for pop/unshift from empty RPA

Modified:
   trunk/t/pmc/resizablepmcarray.t

Modified: trunk/t/pmc/resizablepmcarray.t
==============================================================================
--- trunk/t/pmc/resizablepmcarray.t	Thu May 27 22:00:29 2010	(r47067)
+++ trunk/t/pmc/resizablepmcarray.t	Thu May 27 22:14:36 2010	(r47068)
@@ -21,7 +21,7 @@
     .include 'fp_equality.pasm'
     .include 'test_more.pir'
 
-    plan(129)
+    plan(137)
 
     resize_tests()
     negative_array_size()
@@ -39,6 +39,8 @@
     get_mro_tests()
     push_and_pop()
     unshift_and_shift()
+    shift_empty()
+    pop_empty()
     multikey_access()
     exists_and_defined()
     append_tests()
@@ -579,6 +581,74 @@
     is(elements, 0, "expectedly empty RPA has 0 elements")
 .end
 
+.sub shift_empty
+    .local pmc pmc_arr
+    pmc_arr = new ['ResizablePMCArray']
+    $I1 = 0
+    push_eh handle_i
+    $I0 = shift pmc_arr
+    inc $I1
+handle_i:
+    pop_eh
+    is($I1, 0, 'shift int from empty RPA throws')
+
+    push_eh handle_n
+    $N0 = shift pmc_arr
+    inc $I1
+handle_n:
+    pop_eh
+    is($I1, 0, 'shift num from empty RPA throws')
+
+    push_eh handle_s
+    $S0 = shift pmc_arr
+    inc $I1
+handle_s:
+    pop_eh
+    is($I1, 0, 'shift string from empty RPA throws')
+
+    push_eh handle_p
+    $P0 = shift pmc_arr
+    inc $I1
+handle_p:
+    pop_eh
+    is($I1, 0, 'shift pmc from empty RPA throws')
+
+.end
+
+.sub pop_empty
+    .local pmc pmc_arr
+    pmc_arr = new ['ResizablePMCArray']
+    $I1 = 0
+    push_eh handle_i
+    $I0 = pop pmc_arr
+    inc $I1
+handle_i:
+    pop_eh
+    is($I1, 0, 'pop int from empty RPA throws')
+
+    push_eh handle_n
+    $N0 = pop pmc_arr
+    inc $I1
+handle_n:
+    pop_eh
+    is($I1, 0, 'pop num from empty RPA throws')
+
+    push_eh handle_s
+    $S0 = pop pmc_arr
+    inc $I1
+handle_s:
+    pop_eh
+    is($I1, 0, 'pop string from empty RPA throws')
+
+    push_eh handle_p
+    $P0 = pop pmc_arr
+    inc $I1
+handle_p:
+    pop_eh
+    is($I1, 0, 'pop pmc from empty RPA throws')
+
+.end
+
 ## an Integer Matrix, as used by befunge as a playing field
 .sub multikey_access
     .local pmc matrix, row_in, row_out


More information about the parrot-commits mailing list