Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison tests/farray-alist.t @ 733:772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 07 Oct 2024 14:08:29 +0200 |
| parents | 8f1583faf9ea |
| children | dae85cddc47b |
comparison
equal
deleted
inserted
replaced
| 732:d92e7203a14d | 733:772e4999562b |
|---|---|
| 47 $ falist_set LIST K1 V1 | 47 $ falist_set LIST K1 V1 |
| 48 $ falist_istrue LIST | 48 $ falist_istrue LIST |
| 49 $ falist_set LIST K2 V2 | 49 $ falist_set LIST K2 V2 |
| 50 $ falist_debug LIST | 50 $ falist_debug LIST |
| 51 DEBUG: alist `LIST' has length 2 | 51 DEBUG: alist `LIST' has length 2 |
| 52 DEBUG: the items: | |
| 52 DEBUG: `K1' -> `V1' | 53 DEBUG: `K1' -> `V1' |
| 53 DEBUG: `K2' -> `V2' | 54 DEBUG: `K2' -> `V2' |
| 54 $ falist_length _i LIST | 55 $ falist_length _i LIST |
| 55 $ echo "$_i" | 56 $ echo "$_i" |
| 56 2 | 57 2 |
| 79 $ falist_create LIST | 80 $ falist_create LIST |
| 80 $ falist_set LIST K1 V1 | 81 $ falist_set LIST K1 V1 |
| 81 $ falist_set LIST K2 V2 | 82 $ falist_set LIST K2 V2 |
| 82 $ falist_debug LIST | 83 $ falist_debug LIST |
| 83 DEBUG: alist `LIST' has length 2 | 84 DEBUG: alist `LIST' has length 2 |
| 85 DEBUG: the items: | |
| 84 DEBUG: `K1' -> `V1' | 86 DEBUG: `K1' -> `V1' |
| 85 DEBUG: `K2' -> `V2' | 87 DEBUG: `K2' -> `V2' |
| 86 $ falist_length _i LIST | 88 $ falist_length _i LIST |
| 87 $ echo "$_i" | 89 $ echo "$_i" |
| 88 2 | 90 2 |
| 93 $ falist_set_unique LIST K2 "V2 duplicate" | 95 $ falist_set_unique LIST K2 "V2 duplicate" |
| 94 [1] | 96 [1] |
| 95 $ falist_set LIST K3 $'" 111222333" \\\'444555 ' # ' | 97 $ falist_set LIST K3 $'" 111222333" \\\'444555 ' # ' |
| 96 $ falist_debug LIST | 98 $ falist_debug LIST |
| 97 DEBUG: alist `LIST' has length 3 | 99 DEBUG: alist `LIST' has length 3 |
| 100 DEBUG: the items: | |
| 98 DEBUG: `K1' -> `V1' | 101 DEBUG: `K1' -> `V1' |
| 99 DEBUG: `K2' -> `V2 2' | 102 DEBUG: `K2' -> `V2 2' |
| 100 DEBUG: `K3' -> `" 111222333" \'444555 ' | 103 DEBUG: `K3' -> `" 111222333" \'444555 ' |
| 101 $ falist_length _i LIST | 104 $ falist_length _i LIST |
| 102 $ echo "$_i" | 105 $ echo "$_i" |
| 120 $ echo "${_var}" | 123 $ echo "${_var}" |
| 121 -1 | 124 -1 |
| 122 $ falist_set_unique LIST K4 "V4" | 125 $ falist_set_unique LIST K4 "V4" |
| 123 $ falist_debug LIST | 126 $ falist_debug LIST |
| 124 DEBUG: alist `LIST' has length 4 | 127 DEBUG: alist `LIST' has length 4 |
| 128 DEBUG: the items: | |
| 125 DEBUG: `K1' -> `V1' | 129 DEBUG: `K1' -> `V1' |
| 126 DEBUG: `K2' -> `V2 2' | 130 DEBUG: `K2' -> `V2 2' |
| 127 DEBUG: `K3' -> `" 111222333" \'444555 ' | 131 DEBUG: `K3' -> `" 111222333" \'444555 ' |
| 128 DEBUG: `K4' -> `V4' | 132 DEBUG: `K4' -> `V4' |
| 129 $ falist_release LIST | 133 $ falist_release LIST |
| 232 $ falist_trydel LIST 'key 1' | 236 $ falist_trydel LIST 'key 1' |
| 233 $ falist_trydel LIST 'key 5' | 237 $ falist_trydel LIST 'key 5' |
| 234 $ falist_trydel LIST 'key 3' | 238 $ falist_trydel LIST 'key 3' |
| 235 $ falist_debug LIST | 239 $ falist_debug LIST |
| 236 DEBUG: alist `LIST' has length 2 | 240 DEBUG: alist `LIST' has length 2 |
| 241 DEBUG: the items: | |
| 237 DEBUG: `key 2' -> `value 2' | 242 DEBUG: `key 2' -> `value 2' |
| 238 DEBUG: `key 4' -> `value 4' | 243 DEBUG: `key 4' -> `value 4' |
| 239 $ falist_trydel LIST "non-existing key" | 244 $ falist_trydel LIST "non-existing key" |
| 240 [1] | 245 [1] |
| 241 $ falist_print_length LIST | 246 $ falist_print_length LIST |
| 256 ======= | 261 ======= |
| 257 | 262 |
| 258 $ falist_create LIST1 K1 V1 K2 V2 | 263 $ falist_create LIST1 K1 V1 K2 V2 |
| 259 $ falist_debug LIST1 | 264 $ falist_debug LIST1 |
| 260 DEBUG: alist `LIST1' has length 2 | 265 DEBUG: alist `LIST1' has length 2 |
| 266 DEBUG: the items: | |
| 261 DEBUG: `K1' -> `V1' | 267 DEBUG: `K1' -> `V1' |
| 262 DEBUG: `K2' -> `V2' | 268 DEBUG: `K2' -> `V2' |
| 263 | 269 |
| 264 $ falist_create LIST2 K2 V2 K1 V1 | 270 $ falist_create LIST2 K2 V2 K1 V1 |
| 265 $ falist_debug LIST2 | 271 $ falist_debug LIST2 |
| 266 DEBUG: alist `LIST2' has length 2 | 272 DEBUG: alist `LIST2' has length 2 |
| 273 DEBUG: the items: | |
| 267 DEBUG: `K2' -> `V2' | 274 DEBUG: `K2' -> `V2' |
| 268 DEBUG: `K1' -> `V1' | 275 DEBUG: `K1' -> `V1' |
| 269 | 276 |
| 270 $ falist_create LIST3 K1 V1 K2 V2 | 277 $ falist_create LIST3 K1 V1 K2 V2 |
| 271 $ falist_debug LIST3 | 278 $ falist_debug LIST3 |
| 272 DEBUG: alist `LIST3' has length 2 | 279 DEBUG: alist `LIST3' has length 2 |
| 280 DEBUG: the items: | |
| 273 DEBUG: `K1' -> `V1' | 281 DEBUG: `K1' -> `V1' |
| 274 DEBUG: `K2' -> `V2' | 282 DEBUG: `K2' -> `V2' |
| 275 | 283 |
| 276 $ falist_create LIST4 K1 V1 K2 V2-4 | 284 $ falist_create LIST4 K1 V1 K2 V2-4 |
| 277 $ falist_debug LIST4 | 285 $ falist_debug LIST4 |
| 278 DEBUG: alist `LIST4' has length 2 | 286 DEBUG: alist `LIST4' has length 2 |
| 287 DEBUG: the items: | |
| 279 DEBUG: `K1' -> `V1' | 288 DEBUG: `K1' -> `V1' |
| 280 DEBUG: `K2' -> `V2-4' | 289 DEBUG: `K2' -> `V2-4' |
| 281 | 290 |
| 282 $ falist_are_equal LIST1 LIST2 | 291 $ falist_are_equal LIST1 LIST2 |
| 283 $ falist_are_equal LIST1 LIST4 | 292 $ falist_are_equal LIST1 LIST4 |
| 317 $ falist_are_equal_with_order ARR UPDATE1 | 326 $ falist_are_equal_with_order ARR UPDATE1 |
| 318 | 327 |
| 319 $ falist_update ARR UPDATE2 | 328 $ falist_update ARR UPDATE2 |
| 320 $ falist_debug ARR | 329 $ falist_debug ARR |
| 321 DEBUG: alist `ARR' has length 3 | 330 DEBUG: alist `ARR' has length 3 |
| 331 DEBUG: the items: | |
| 322 DEBUG: `Key 1' -> `Value 1' | 332 DEBUG: `Key 1' -> `Value 1' |
| 323 DEBUG: `Key 2' -> `Value 2 (Updated) '' | 333 DEBUG: `Key 2' -> `Value 2 (Updated) '' |
| 324 DEBUG: `Key 3' -> `Value 3' | 334 DEBUG: `Key 3' -> `Value 3' |
| 325 | 335 |
| 326 Updating an into an empty alist is just a copy | 336 Updating an into an empty alist is just a copy |
| 327 | 337 |
| 328 $ falist_update EMPTY UPDATE1 | 338 $ falist_update EMPTY UPDATE1 |
| 329 $ falist_debug EMPTY | 339 $ falist_debug EMPTY |
| 330 DEBUG: alist `EMPTY' has length 2 | 340 DEBUG: alist `EMPTY' has length 2 |
| 341 DEBUG: the items: | |
| 331 DEBUG: `Key 1' -> `Value 1' | 342 DEBUG: `Key 1' -> `Value 1' |
| 332 DEBUG: `Key 2' -> `Value 2 '' | 343 DEBUG: `Key 2' -> `Value 2 '' |
| 333 $ falist_debug UPDATE1 | 344 $ falist_debug UPDATE1 |
| 334 DEBUG: alist `UPDATE1' has length 2 | 345 DEBUG: alist `UPDATE1' has length 2 |
| 346 DEBUG: the items: | |
| 335 DEBUG: `Key 1' -> `Value 1' | 347 DEBUG: `Key 1' -> `Value 1' |
| 336 DEBUG: `Key 2' -> `Value 2 '' | 348 DEBUG: `Key 2' -> `Value 2 '' |
| 337 | 349 |
| 338 $ falist_release ARR | 350 $ falist_release ARR |
| 339 $ falist_release UPDATE1 | 351 $ falist_release UPDATE1 |
| 351 $ farray_create ITEMS | 363 $ farray_create ITEMS |
| 352 $ falist_create LIST "Key 1" "Value 1" "Key 2" 'Value 2 '\''' | 364 $ falist_create LIST "Key 1" "Value 1" "Key 2" 'Value 2 '\''' |
| 353 $ falist_items ITEMS LIST | 365 $ falist_items ITEMS LIST |
| 354 $ farray_debug ITEMS | 366 $ farray_debug ITEMS |
| 355 DEBUG: array `ITEMS' has length 4 | 367 DEBUG: array `ITEMS' has length 4 |
| 356 DEBUG: its contents: | 368 DEBUG: the items: |
| 357 DEBUG: 1: `Key 1' | 369 DEBUG: 1: `Key 1' |
| 358 DEBUG: 2: `Value 1' | 370 DEBUG: 2: `Value 1' |
| 359 DEBUG: 3: `Key 2' | 371 DEBUG: 3: `Key 2' |
| 360 DEBUG: 4: `Value 2 '' | 372 DEBUG: 4: `Value 2 '' |
| 361 $ falist_keys KEYS LIST | 373 $ falist_keys KEYS LIST |
| 362 $ farray_debug KEYS | 374 $ farray_debug KEYS |
| 363 DEBUG: array `KEYS' has length 2 | 375 DEBUG: array `KEYS' has length 2 |
| 364 DEBUG: its contents: | 376 DEBUG: the items: |
| 365 DEBUG: 1: `Key 1' | 377 DEBUG: 1: `Key 1' |
| 366 DEBUG: 2: `Key 2' | 378 DEBUG: 2: `Key 2' |
| 367 $ falist_values VALUES LIST | 379 $ falist_values VALUES LIST |
| 368 $ farray_debug VALUES | 380 $ farray_debug VALUES |
| 369 DEBUG: array `VALUES' has length 2 | 381 DEBUG: array `VALUES' has length 2 |
| 370 DEBUG: its contents: | 382 DEBUG: the items: |
| 371 DEBUG: 1: `Value 1' | 383 DEBUG: 1: `Value 1' |
| 372 DEBUG: 2: `Value 2 '' | 384 DEBUG: 2: `Value 2 '' |
| 373 | 385 |
| 374 $ falist_release LIST | 386 $ falist_release LIST |
| 375 $ farray_release KEYS | 387 $ farray_release KEYS |
| 417 =================== | 429 =================== |
| 418 | 430 |
| 419 $ falist_create LIST k1 v2 | 431 $ falist_create LIST k1 v2 |
| 420 $ falist_debug LIST | 432 $ falist_debug LIST |
| 421 DEBUG: alist `LIST' has length 1 | 433 DEBUG: alist `LIST' has length 1 |
| 434 DEBUG: the items: | |
| 422 DEBUG: `k1' -> `v2' | 435 DEBUG: `k1' -> `v2' |
| 423 $ _farr_release_object "$LIST" | 436 $ _farr_release_object "$LIST" |
| 424 $ check_no_alist_artifacts | 437 $ check_no_alist_artifacts |
| 425 $ (_farr_release_object "$LIST") | 438 $ (_farr_release_object "$LIST") |
| 426 ERROR: falist `_farr_KV\[\?,\?\]:([a-f0-9]+)' not created properly: no object for token `\1' (re) | 439 ERROR: falist `_farr_KV\[\?,\?\]:([a-f0-9]+)' not created properly: no object for token `\1' (re) |
| 438 $ falist_create ITEM1 K11 V11 K22 V22 | 451 $ falist_create ITEM1 K11 V11 K22 V22 |
| 439 $ falist_set LIST K2 "$ITEM1" | 452 $ falist_set LIST K2 "$ITEM1" |
| 440 $ falist_release ITEM1 | 453 $ falist_release ITEM1 |
| 441 $ falist_debug LIST | 454 $ falist_debug LIST |
| 442 DEBUG: alist `LIST' has length 2 | 455 DEBUG: alist `LIST' has length 2 |
| 443 DEBUG: `K1' -> `V1' | 456 DEBUG: the items: |
| 444 DEBUG: `K2': --> | 457 DEBUG: `K1' -> `V1' |
| 458 DEBUG: `K2' -> >>> | |
| 445 DEBUG: alist with token `[a-f0-9]+' has length 2 (re) | 459 DEBUG: alist with token `[a-f0-9]+' has length 2 (re) |
| 460 DEBUG: the items: | |
| 446 DEBUG: `K11' -> `V11' | 461 DEBUG: `K11' -> `V11' |
| 447 DEBUG: `K22' -> `V22' | 462 DEBUG: `K22' -> `V22' |
| 448 $ falist_release LIST | 463 $ falist_release LIST |
| 449 $ check_no_alist_artifacts | 464 $ check_no_alist_artifacts |
