Ticket #794: TT_794.patch

File TT_794.patch, 1.5 KB (added by NotFound, 13 years ago)

Fix and test for HLL mapped split

  • src/string/api.c

     
    33613361    if (STRING_IS_NULL(delim) || STRING_IS_NULL(str)) 
    33623362        return PMCNULL; 
    33633363 
    3364     res  = pmc_new(interp, enum_class_ResizableStringArray); 
     3364    res  = pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_ResizableStringArray)); 
    33653365    slen = Parrot_str_byte_length(interp, str); 
    33663366 
    33673367    if (!slen) 
  • t/op/string.t

     
    77use lib qw( . lib ../lib ../../lib ); 
    88 
    99use Test::More; 
    10 use Parrot::Test tests => 165; 
     10use Parrot::Test tests => 166; 
    1111use Parrot::Config; 
    1212 
    1313=head1 NAME 
     
    26392639 
    26402640OUTPUT 
    26412641 
     2642pir_output_is( <<'CODE', <<'OUTPUT', 'split HLL mapped' ); 
     2643.HLL 'foohll' 
     2644.sub main 
     2645    .local pmc RSA, fooRSA 
     2646    RSA = get_class ['ResizableStringArray'] 
     2647    fooRSA = subclass ['ResizableStringArray'], 'fooRSA' 
     2648    .local pmc interp 
     2649    interp = getinterp 
     2650    interp.'hll_map'(RSA, fooRSA) 
     2651    .local pmc a 
     2652    split a, "a", "afooabara" 
     2653    .local string t 
     2654    t = typeof a 
     2655    say t 
     2656    .local int n, i 
     2657    n = a 
     2658    say n 
     2659    i = 0 
     2660loop: 
     2661    .local string s 
     2662    s = a[i] 
     2663    say s 
     2664    inc i 
     2665    if i != n goto loop 
     2666.end 
     2667CODE 
     2668fooRSA 
     26695 
     2670 
     2671foo 
     2672b 
     2673r 
     2674 
     2675OUTPUT 
     2676 
    26422677pasm_output_is( <<'CODE', <<'OUTPUT', 'join' ); 
    26432678_main: 
    26442679    new P0, 'ResizablePMCArray'