Ticket #1589: tt1589.patch

File tt1589.patch, 2.2 KB (added by soh_cah_toa, 3 years ago)

Patch incudes both the changes and tests.

  • src/library.c

    diff --git a/src/library.c b/src/library.c
    index 2bb9e13..b3758b9 100644
    a b  
    155155        if (!STRING_IS_NULL(envvar) && !STRING_IS_EMPTY(envvar)) 
    156156            VTABLE_push_string(interp, paths, envvar); 
    157157    } 
    158     entry = CONST_STRING(interp, "./"); 
    159     VTABLE_push_string(interp, paths, entry); 
    160158 
    161159    /* define library paths */ 
    162160    paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray); 
     
    168166        if (!STRING_IS_NULL(envvar) && !STRING_IS_EMPTY(envvar)) 
    169167            VTABLE_push_string(interp, paths, envvar); 
    170168    } 
    171     entry = CONST_STRING(interp, "./"); 
    172     VTABLE_push_string(interp, paths, entry); 
    173169 
    174170    /* define languages paths */ 
    175171    paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray); 
    176172    VTABLE_set_pmc_keyed_int(interp, lib_paths, 
    177173            PARROT_LIB_PATH_LANG, paths); 
    178     entry = CONST_STRING(interp, "./"); 
    179     VTABLE_push_string(interp, paths, entry); 
    180174 
    181175    /* define dynext paths */ 
    182176    paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray); 
  • (a) /dev/null vs. (b) b/t/library/lib_search_path.t

    diff --git a/t/library/lib_search_path.t b/t/library/lib_search_path.t
    new file mode 100644
    index 0000000..62c3cca
    a b  
     1#!./parrot 
     2# Copyright (C) 2011 Parrot Foundation. 
     3 
     4=head1 NAME 
     5 
     6t/library/lib_search_path.t - testing for proper search path precedence 
     7 
     8=head1 SYNOPSIS 
     9 
     10This test program verifies that Parrot searches for libraries in the 
     11proper order. 
     12 
     13=head1 AUTHOR 
     14 
     15Kevin Polulak (a.k.a. soh_cah_toa) kpolulak@gmail.com 
     16 
     17=cut 
     18 
     19.const string TESTS = 2 
     20 
     21.sub 'main' :main 
     22    .include 'test_more.pir' 
     23 
     24    .local pmc lib 
     25    .local pmc lib_cwd 
     26 
     27    plan(TESTS) 
     28 
     29    # Verify current working directory isn't searched 
     30    lib_cwd = loadlib 'lib_search_path.t' 
     31    is(lib_cwd, '', 'Verify current working directory not searched') 
     32 
     33    # Verify runtime/parrot/dynext is searched 
     34        lib = loadlib 'osutils.pir' 
     35    isnt(lib, '', 'Verify runtime/parrot/dynext is searched') 
     36.end 
     37 
     38# Local Variables: 
     39#   mode: pir 
     40#   fill-column: 100 
     41# End: 
     42# vim: expandtab shiftwidth=4 ft=pir: 
     43