comparison tests/testsetup.sh @ 758:7ead30e3b2f9

farray.sh: Check for typos in local variable names or missing "local" declarations for variables
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 20 Oct 2024 14:43:50 +0200
parents 33df05108ba1
children bae0652d0577
comparison
equal deleted inserted replaced
757:a339666cb421 758:7ead30e3b2f9
1 #!/bin/sh 1 #!/bin/sh
2 # 2 #
3 # Test helpers for the shell unittests using cram. 3 # Test helpers for the shell unittests using cram.
4 # 4 #
5
6
7 #:
8 #: Set some directories to temporary values for inclusion of test configuration
9 #: files.
10 #:
11 CONFIGDIR="${TESTDIR}/etc"
12 PACKAGE_MAPPING="${CONFIGDIR}/package-mapping.conf"
13
5 14
6 #: 15 #:
7 #: Check that no global variables that hold any array storage are left. 16 #: Check that no global variables that hold any array storage are left.
8 #: 17 #:
9 #: Returns: 18 #: Returns:
31 return 1 40 return 1
32 else 41 else
33 return 0 42 return 0
34 fi 43 fi
35 } 44 }
45
46
47 #:
48 #: Check that no local variables are globally visible.
49 #:
50 #: Because all local variables have the ``__farr_`` prefix it can easily
51 #: checked that no forgotten "local" declarations exist.
52 #:
53 check_no_local_artifacts() {
54 if set | grep -E -e '^__farr.*='; then
55 return 1
56 else
57 return 0
58 fi
59 }