sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

test-complete.sh (1436B)


      1 # source script for ble.sh interactive sessions -*- mode: sh; mode: sh-bash -*-
      2 
      3 ble-import lib/core-complete
      4 ble-import lib/core-test
      5 
      6 ble/test/start-section 'ble/complete' 7
      7 
      8 (
      9   ## @fn _collect
     10   ##   @arr[in] args ret
     11   ##   @var[out] ret
     12   function _collect {
     13     local text=${args[1]} p0=0 i out=
     14     for ((i=0;i<${#ret[@]};i++)); do
     15       ((p=ret[i]))
     16       if ((i%2==0)); then
     17         out=$out${text:p0:p-p0}'['
     18       else
     19         out=$out${text:p0:p-p0}']'
     20       fi
     21       p0=$p
     22     done
     23     ((p0<${#text})) && out=$out${text:p0}
     24     ret=$out
     25   }
     26   ble/test 'args=(akf Makefile 0); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='M[ak]e[f]ile'
     27   ble/test 'args=(akf Makefile 1); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='Makefile'
     28   ble/test 'args=(Mkf Makefile 1); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='[M]a[k]e[f]ile'
     29   ble/test 'args=(Maf Makefile 1); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='[Ma]ke[f]ile'
     30   ble/test 'args=(Mak Makefile 1); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='[Mak]efile'
     31   ble/test 'args=(ake Makefile 0); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='M[ake]file'
     32   ble/test 'args=(afe Makefile 0); ble/complete/candidates/filter:hsubseq/match "${args[@]}"; _collect' ret='M[a]ke[f]il[e]'
     33 )
     34 
     35 ble/test/end-section