fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
bf2f7ee6c
master
1#!/usr/bin/env python3 2from pexpect_helper import SpawnedProc 3from time import sleep 4import os 5import sys 6 7# Disable under CI - keeps failing because the timing is too tight 8if "CI" in os .environ : 9sys .exit (127 ) 10 11os .environ ["fish_escape_delay_ms" ]= "10" 12sp = SpawnedProc () 13send ,sendline ,sleep ,expect_prompt ,expect_re ,expect_str = ( 14sp .send , 15sp .sendline , 16sp .sleep , 17sp .expect_prompt , 18sp .expect_re , 19sp .expect_str , 20) 21expect_prompt () 22 23sendline ("$fish_key_reader --version" ) 24expect_re ("fish_key_reader, version .*" ) 25expect_prompt () 26 27sendline ("$fish_key_reader -c -V" ) 28 29# Do we get the expected startup prompt? 30expect_str ("Press a key:" ) 31 32# Is a single control char echoed correctly? 33send ("\x07" ) 34expect_str ("# decoded from: \\x07\r\n" ) 35expect_str ("bind ctrl-g 'do something'\r\n" ) 36 37# Is a non-ASCII UTF-8 sequence prefaced by an escape char handled correctly? 38sleep (0.020 ) 39send ("\x1b" ) 40expect_str ("# decoded from: \\e\r\n" ) 41expect_str ("bind escape 'do something'\r\n" ) 42send ("ö" ) 43expect_str ("# decoded from: ö\r\n" ) 44expect_str ("bind ö 'do something'\r\n" ) 45send ("\u1234" ) 46expect_str ("bind ሴ 'do something'\r\n" ) 47 48# Is a NULL char echoed correctly? 49sleep (0.020 ) 50send ("\x00" ) 51expect_str ("bind ctrl-space 'do something'\r\n" ) 52 53send ("\x1b\x7f" ) 54expect_str ("# decoded from: \\e\\x7f\r\n" ) 55expect_str ("bind alt-backspace 'do something'\r\n" ) 56 57send ("\x1c" ) 58expect_str (r"bind ctrl-\\ 'do something'" ) 59 60# Does it keep running if handed control sequences in the wrong order? 61send ("\x03" ) 62sleep (0.010 ) 63send ("\x04" ) 64 65# Now send a second ctrl-d. Does that terminate the process like it should? 66sleep (0.050 ) 67send ("\x04" ) 68expect_str ("Exiting at your request.\r\n" ) 69expect_prompt () 70 71sendline ("fish_features=no-qmark-noglob $fish_key_reader" ) 72send ("?" ) 73expect_str (r"bind \? 'do something'" ) 74send ("\x04" )