Update tests.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
CismonX 2021-02-02 15:23:50 +08:00
parent 5f1ddd66d8
commit 07d2b941b5
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
4 changed files with 47 additions and 7 deletions

View File

@ -0,0 +1,33 @@
#
# 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 CSI_8BIT "\x9b"
tcsgrep_start
# Use Latin-1 charset, which supports 8-bit characters.
# Otherwise it will be converted into a 2-byte UTF-8 character.
fconfigure $spawn_id -encoding iso8859-1
send $CSI_8BIT
expect {
# ctlseqs does not recognize 8-bit control characters,
# but reading them should not break the program.
-ex "NOSEQ 1 \\x9b\n" {
pass "pass"
}
default {
puts $expect_out(buffer)
fail "fail"
}
}
tcsgrep_stop

View File

@ -28,7 +28,7 @@ tcsgrep_start
for { set i 0 } { $i < [ llength $input ] } { incr i } {
set seq [ lindex $input $i ]
set expected [ lindex $output $i ]
send -- $seq
send $seq
expect {
-ex "$expected\n" {
pass "pass"

View File

@ -9,12 +9,15 @@
set tool ctlseqs
set timeout 2
# Tests library behaviour when read buffer is full.
# Also tests whether buffer purging works.
set seq "${CSI}123;4567S"
set expected "NOMEM 10 ESC \[ 1 2 3 ; 4 5 6 7\nNOSEQ 1 S"
tcsgrep_start limit=10 purge
send -- $seq
send $seq
expect {
-ex "$expected\n" {
pass "pass"

View File

@ -14,9 +14,11 @@ set nlen [ string length $n1 ]
tcsgrep_start verbose
send -- "$CSI"
send "$CSI"
expect {
-ex "PARTIAL 2 ESC \[\n" { }
-ex "PARTIAL 2 ESC \[\n" {
pass "pass"
}
default {
puts $expect_out(buffer)
fail "fail"
@ -24,9 +26,11 @@ expect {
}
for { set i 0 } { $i < $nlen } { incr i } {
send -- [ string index $n1 $i ]
send [ string index $n1 $i ]
expect {
-ex "PARTIAL [ expr $i + 3 ] ESC \[ [ split [ string range $n1 0 $i ] {} ]\n" { }
-ex "PARTIAL [ expr $i + 3 ] ESC \[ [ split [ string range $n1 0 $i ] {} ]\n" {
pass "pass"
}
default {
puts $expect_out(buffer)
fail "fail"
@ -34,7 +38,7 @@ for { set i 0 } { $i < $nlen } { incr i } {
}
}
send -- "p"
send "p"
expect {
-ex "NOMATCH [ expr $nlen + 3 ] ESC \[ [ split $n1 {} ] p\n" {
pass "pass"