#!/bin/bash # $HeadURL$ $LastChangedRevision$ # For each library language (shell, perl, python, this test calls a # function that has been replaced by a call to replace_function()). # We are interested in three things: does the "function X has been # superceded by function Y" message appear;; does setting # ADE_REPLACE_FUNCTION_SILENT silence that message; even though we # call the function twice, we still expected to see the warning # only once. for ADE_REPLACE_FUNCTION_SILENT in "" 1; do export ADE_REPLACE_FUNCTION_SILENT echo "ADE_REPLACE_FUNCTION_SILENT=$ADE_REPLACE_FUNCTION_SILENT" echo "bash ..." # Because bash does not have name spaces, there is nothing to prevent # library function _ade_replace_function() from creating a function (old()) that can # can then be accessed by script adeshf. adeshf 'new() { :; }; MYSTACK=(); _ade_replace_function MYSTACK old new; old MYSTACK; old MYSTACK; return $ADE_OK' echo "perl ..." # In perl that does not work. Although ADE::_replace_function can *define* # the function, adeperlf would be forced to use ADE:: prefix to call it, # The division of what is being done in which namespace would not be # intuitive, so we just don't do it and instead call a function that is # defined by ADE itself (ADE::eval() replaced by ADE::evaler()). adeperlf 'ADE::eval([], "true"); ADE::eval([], "true"); return $ADE::OK;' echo "python ..." # I suspect the same would be true for python. adepyf 'import ade; ade.eval([], "true"); ade.eval([], "true"); return ade.ok' done echo "all done"