ctlseqs/tests/ctlseqs/match.exp

44 lines
1.0 KiB
Plaintext

#
# Copyright (C) 2021 CismonX <admin@cismon.net>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty, provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any warranty.
#
set tool ctlseqs
set timeout 2
set n1 [ random_int ]
set n2 [ random_int ]
set n3 [ random_int ]
set input { }
lappend input "$CSI$n1;${n2}H"
lappend input "$DCS$n1;$n2|$n3$ST"
lappend input "$CSI<?${n1}Z"
set output { }
lappend output "OK CUP $n1 $n2"
lappend output "OK DECUDK $n1 $n2 $n3"
lappend output "NOMATCH [ expr [ string length $n1 ] + 5 ] ESC \[ < ? [ split $n1 {} ] Z"
tcsgrep_start
for { set i 0 } { $i < [ llength $input ] } { incr i } {
set seq [ lindex $input $i ]
set expected [ lindex $output $i ]
send -- $seq
expect {
-ex "$expected\n" {
pass "pass"
}
default {
puts $expect_out(buffer)
fail "fail"
}
}
}
tcsgrep_stop