sistema_progs

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

test-decode.sh (3086B)


      1 # source script for ble.sh interactive sessions -*- mode: sh; mode: sh-bash -*-
      2 
      3 ble-import lib/core-test
      4 
      5 ble/test/start-section 'ble/decode' 33
      6 
      7 # ble/builtin/bind/.parse-keyname
      8 (
      9   # valid cases
     10   ble/test 'ble/builtin/bind/.parse-keyname tab    ; ret=${chars[0]}' ret=9
     11   ble/test 'ble/builtin/bind/.parse-keyname TAB    ; ret=${chars[0]}' ret=9
     12   ble/test 'ble/builtin/bind/.parse-keyname newline; ret=${chars[0]}' ret=10
     13   ble/test 'ble/builtin/bind/.parse-keyname LFD    ; ret=${chars[0]}' ret=10
     14   ble/test 'ble/builtin/bind/.parse-keyname Return ; ret=${chars[0]}' ret=13
     15   ble/test 'ble/builtin/bind/.parse-keyname RET    ; ret=${chars[0]}' ret=13
     16   ble/test 'ble/builtin/bind/.parse-keyname Space  ; ret=${chars[0]}' ret=32
     17   ble/test 'ble/builtin/bind/.parse-keyname SPC    ; ret=${chars[0]}' ret=32
     18   ble/test 'ble/builtin/bind/.parse-keyname Rubout ; ret=${chars[0]}' ret=127
     19   ble/test 'ble/builtin/bind/.parse-keyname DEL   ; ret=${chars[0]}' ret=127
     20   ble/test 'ble/builtin/bind/.parse-keyname Escape ; ret=${chars[0]}' ret=27
     21   ble/test 'ble/builtin/bind/.parse-keyname ESC    ; ret=${chars[0]}' ret=27
     22   ble/test 'ble/builtin/bind/.parse-keyname C-Space; ret=${chars[0]}' ret=0
     23   ble/test 'ble/builtin/bind/.parse-keyname s      ; ret=${chars[0]}' ret=115
     24   ble/test 'ble/builtin/bind/.parse-keyname S      ; ret=${chars[0]}' ret=83
     25 
     26   # invalid cases
     27   ble/test "ble/builtin/bind/.parse-keyname '\C-x\C-y'     ; ret=\${chars[0]}" ret=25  # C-y
     28   ble/test "ble/builtin/bind/.parse-keyname 'xyz'          ; ret=\${chars[0]}" ret=120 # x
     29   ble/test "ble/builtin/bind/.parse-keyname '\a'           ; ret=\${chars[0]}" ret=92  # \ (backslash)
     30   ble/test "ble/builtin/bind/.parse-keyname '\C-nop'       ; ret=\${chars[0]}" ret=14  # C-n
     31   ble/test "ble/builtin/bind/.parse-keyname '\C-xC-y'      ; ret=\${chars[0]}" ret=25  # C-y
     32   ble/test "ble/builtin/bind/.parse-keyname '\C-axC-b'     ; ret=\${chars[0]}" ret=2   # C-b
     33   ble/test "ble/builtin/bind/.parse-keyname 'helloC-b'     ; ret=\${chars[0]}" ret=2   # C-b
     34   ble/test "ble/builtin/bind/.parse-keyname 'helloC-x,TAB' ; ret=\${chars[0]}" ret=24  # C-x
     35   ble/test "ble/builtin/bind/.parse-keyname 'C-xTAB'       ; ret=\${chars[0]}" ret=24  # C-x
     36   ble/test "ble/builtin/bind/.parse-keyname 'TABC-x'       ; ret=\${chars[0]}" ret=24  # C-x
     37   ble/test "ble/builtin/bind/.parse-keyname 'BC-'          ; ret=\${chars[0]}" ret=0   # C-@
     38   ble/test "ble/builtin/bind/.parse-keyname 'C-M-a'        ; ret=\${chars[0]}" ret=129 # C-M-a
     39   ble/test "ble/builtin/bind/.parse-keyname 'M-C-a'        ; ret=\${chars[0]}" ret=129 # C-M-a
     40   ble/test "ble/builtin/bind/.parse-keyname 'C-aalpha-beta'; ret=\${chars[0]}" ret=2   # C-b
     41   ble/test "ble/builtin/bind/.parse-keyname '\C-a\M-c'     ; ret=\${chars[0]}" ret=131 # C-M-c
     42   ble/test "ble/builtin/bind/.parse-keyname 'panic-trim-c' ; ret=\${chars[0]}" ret=131 # C-M-c
     43   ble/test "ble/builtin/bind/.parse-keyname 'C--'          ; ret=\${chars[0]}" ret=0   # C-@
     44   ble/test "ble/builtin/bind/.parse-keyname 'C--x'         ; ret=\${chars[0]}" ret=24  # C-x
     45 )
     46 
     47 ble/test/end-section