# HG changeset patch # User Franz Glasner # Date 1728300868 -7200 # Node ID d92e7203a14de956b58e2ed5bae917fdb3f31f71 # Parent cf0f18d3d41b75b007a89fb030cbd70dbab9be4f farray.sh: an official function fobject_type() instead of an internal one diff -r cf0f18d3d41b -r d92e7203a14d share/local-bsdtools/farray.sh --- a/share/local-bsdtools/farray.sh Mon Oct 07 13:26:25 2024 +0200 +++ b/share/local-bsdtools/farray.sh Mon Oct 07 13:34:28 2024 +0200 @@ -88,7 +88,7 @@ #: for private use in this module. #: Do not use such names in your scripts. #: -#: Public functions start with ``farray_`` or ``falist_``. +#: Public functions start with ``farray_, ``falist_`` or ``fobject_``. #: @@ -357,10 +357,10 @@ #: -#: Internal implementation of typing +#: Implementation of typing #: #: Args: -#: $1 (str): The name of an object +#: $1 (str): The (variable) name of an object #: #: Output (stdout): #: - array: an array @@ -372,7 +372,7 @@ #: Returns: #: int: 0 always #: -_farr_type() { +fobject_type() { local __farr_type_name local __farr_type_token @@ -409,10 +409,10 @@ #: -#: Just an official alias for `_farr_type` +#: Just an official alias for `fobject_type` #: farray_type() { - _farr_type "$@" + fobject_type "$@" } @@ -426,7 +426,7 @@ #: int: 0 if `$1` is an array, 1 otherwise #: farray_isarray() { - [ "$(_farr_type "$@")" = 'array' ] + [ "$(fobject_type "$@")" = 'array' ] } @@ -1652,10 +1652,10 @@ #: -#: Just an official alias for `_farr_type` +#: Just an official alias for `fobject_type` #: falist_type() { - _farr_type "$@" + fobject_type "$@" } @@ -1669,7 +1669,7 @@ #: int: 0 if `$1` is an alist, 1 otherwise #: falist_isalist() { - [ "$(_farr_type "$@")" = 'alist' ] + [ "$(fobject_type "$@")" = 'alist' ] } diff -r cf0f18d3d41b -r d92e7203a14d tests/farray-object.t --- a/tests/farray-object.t Mon Oct 07 13:26:25 2024 +0200 +++ b/tests/farray-object.t Mon Oct 07 13:34:28 2024 +0200 @@ -16,6 +16,12 @@ ===== $ farray_create ARRAY1 i1 i2 + $ fobject_type ARRAY1 + array (no-eol) + $ farray_type ARRAY1 + array (no-eol) + $ falist_type ARRAY1 + array (no-eol) $ farray_create ITEM1 i11 i22 $ farray_append ARRAY1 "$ITEM1" $ farray_release ITEM1 @@ -47,6 +53,12 @@ ===== $ falist_create LIST1 k1 v1 + $ fobject_type LIST1 + alist (no-eol) + $ falist_type LIST1 + alist (no-eol) + $ farray_type LIST1 + alist (no-eol) $ falist_create ITEM1 k11 v11 k22 v22 k33 v33 k44 v44 $ falist_set LIST1 k2 "$ITEM1" $ falist_release ITEM1