X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=test%2Ftest;h=c3b90e166a0d7cc6d02dea10b7de23437aff6b3d;hb=HEAD;hp=d3a5eac00b8976fc42db94d7c0c2729a46f5cb78;hpb=fae0c9143e694a3ed895cee68d1adad9bc359f05;p=lnf diff --git a/test/test b/test/test index d3a5eac..c3b90e1 100755 --- a/test/test +++ b/test/test @@ -1,4 +1,27 @@ #!/bin/bash +# I, Ian Kelling, follow the GNU license recommendations at +# https://www.gnu.org/licenses/license-recommendations.en.html. They +# recommend that small programs, < 300 lines, be licensed under the +# Apache License 2.0. This file contains or is part of one or more small +# programs. If a small program grows beyond 300 lines, I plan to switch +# its license to GPL. + +# Copyright 2024 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + # some basic sanity / verification # I don't recommend actually running this unless you have a reason to, @@ -61,7 +84,8 @@ docases() { done } -source ${0%/*}/../lnf-function +PATH="$(readlink -f ${0%/*}/..):$PATH" + # might want to undo this if things go wrong # set -x @@ -69,12 +93,13 @@ source ${0%/*}/../lnf-function set -E; trap 'echo "${BASH_COMMAND:+BASH_COMMAND=\"$BASH_COMMAND\" } ${FUNCNAME:+FUNCNAME=\"$FUNCNAME\" }${LINENO:+LINENO=\"$LINENO\" }\$?=$?"' ERR -cd $(mktemp -d) +tempdir=$(mktemp -d) +cd $tempdir docases # test again, using rm -rf in place of trash-put. -# assumes that rm is in /bin and trash-put is in /usr/bin -PATH="${PATH//:\/usr\/bin}" -PATH="${PATH//\/usr\/bin:}" +trash-put() { rm -rf -- "$@"; } +export -f trash-put docases +rm -rf $tempdir echo tests concluded