Permalink
Browse files

[t][TT #1589] Apply patch from soh_cah_toa++ with small tweaks and an…

… extra test
  • Loading branch information...
1 parent e3ecaf8 commit 98a30ccf3475c6e7b1d6953d593d6903337c4d81 @leto leto committed May 4, 2011
Showing with 59 additions and 6 deletions.
  1. +0 −6 src/library.c
  2. +14 −0 t/library/dont_load_me.pir
  3. +45 −0 t/library/lib_search_path.t
View
@@ -155,8 +155,6 @@ parrot_init_library_paths(PARROT_INTERP)
if (!STRING_IS_NULL(envvar) && !STRING_IS_EMPTY(envvar))
VTABLE_push_string(interp, paths, envvar);
}
- entry = CONST_STRING(interp, "./");
- VTABLE_push_string(interp, paths, entry);
/* define library paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
@@ -168,15 +166,11 @@ parrot_init_library_paths(PARROT_INTERP)
if (!STRING_IS_NULL(envvar) && !STRING_IS_EMPTY(envvar))
VTABLE_push_string(interp, paths, envvar);
}
- entry = CONST_STRING(interp, "./");
- VTABLE_push_string(interp, paths, entry);
/* define languages paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
VTABLE_set_pmc_keyed_int(interp, lib_paths,
PARROT_LIB_PATH_LANG, paths);
- entry = CONST_STRING(interp, "./");
- VTABLE_push_string(interp, paths, entry);
/* define dynext paths */
paths = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
View
@@ -0,0 +1,14 @@
+# Copyright (C) 2011, Parrot Foundation.
+
+# This file is part of the t/library/lib_search_path.t tests
+
+.sub 'main' :main
+ die "Bad juju"
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+
@@ -0,0 +1,45 @@
+#!./parrot
+# Copyright (C) 2011 Parrot Foundation.
+
+=head1 NAME
+
+t/library/lib_search_path.t - testing for proper search path precedence
+
+=head1 SYNOPSIS
+
+This test program verifies that Parrot searches for libraries in the
+proper order.
+
+=head1 AUTHOR
+
+Kevin Polulak (a.k.a. soh_cah_toa) kpolulak@gmail.com
+
+=cut
+
+.const int TESTS = 3
+
+.sub 'main' :main
+ .include 'test_more.pir'
+
+ .local pmc lib
+
+ plan(TESTS)
+
+ # Verify current working directory isn't searched
+ lib = loadlib 'lib_search_path.t'
+ is(lib, '', 'Verify current working directory not searched')
+
+ lib = loadlib 'dont_load_me.pir'
+ is(lib, '', 'Verify current working directory not searched')
+
+ # Verify runtime/parrot/dynext is searched
+ lib = loadlib 'osutils.pir'
+ isnt(lib, '', 'Verify runtime/parrot/dynext is searched')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

0 comments on commit 98a30cc

Please sign in to comment.