view tests/testsetup.sh @ 756:33df05108ba1

farray.sh: New implementation alists: searching is done using a binary search now while preserving insertion order. The implementation uses two key lists: The first one is sorted and is used for searching using binary search. The second is a double-linked list and is used for remembering the insertion order.
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 19 Oct 2024 22:40:11 +0200
parents 45c47bc1f7d2
children 7ead30e3b2f9
line wrap: on
line source

#!/bin/sh
#
# Test helpers for the shell unittests using cram.
#

#:
#: Check that no global variables that hold any array storage are left.
#:
#: Returns:
#:   int: 0 if no unexpected storage is left, 1 otherwise
#:
check_no_array_artifacts() {
    # _farr_A_ is the storage prefix for arrays
    if set | grep -E -e '^_farr_A_.*='; then
	return 1
    else
	return 0
    fi
}


#:
#: Check that no global variables that hold any alist storage are left.
#:
#: Returns:
#:   int: 0 if no unexpected storage is left, 1 otherwise
#:
check_no_alist_artifacts() {
    # This are all _farr_alist_XXX_prefix variables
    if set | grep -E -e '^_farr_KV_.*=' -e '^_farr_Kb_.*=' -e '^_farr_Ks_.*=' -e '^_farr_Vs_.*='; then
	return 1
    else
	return 0
    fi
}