okami.mom/albedo
git clone https://git.nkp.pet/okami.mom/albedo
341e569
main
1// Terminal escape replies and yes/no input must not accidentally approve destructive prompts; non-TTY E2E cannot exercise this parser. 2package terminal 3 4import ( 5"testing" 6) 7 8func TestConfirmed (t * testing.T ) { 9for answer ,want := range map [string ]bool { 10"y\n" :true ," YES \n" :true ,"\x1b]11;rgb:1e1e/1e1e/2e2e\x1b\\\x1b[24;1Ry\n" :true , 11"\n" :false ,"n\n" :false ,"" :false ,"yep\n" :false , 12 } { 13if got := Confirmed (answer );got != want { 14t .Errorf ("Confirmed(%q) = %v, want %v" ,answer ,got ,want ) 15 } 16 } 17}