Add support for running interactive test with expect - clic - Clic is an command line interactive client for gopher written in Common LISP HTML git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/clic/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit c2c3178142a5fec87b71d7e4f4b8b2d8fc5446c0 DIR parent ba86c5e114249375116d7d40a5b66bc2e2baa4ce HTML Author: Solene Rapenne <solene@perso.pw> Date: Thu, 16 Nov 2017 12:08:14 +0000 Add support for running interactive test with expect Diffstat: A interactive-test.exp | 106 ++++++++++++++++++++++++++++++ M run-test.sh | 2 ++ 2 files changed, 108 insertions(+), 0 deletions(-) --- DIR diff --git a/interactive-test.exp b/interactive-test.exp @@ -0,0 +1,106 @@ +proc user_input {} { + + expect "clic => " + + send "garbage\n" + expect "clic => " + send ". . ~. ~ .\n" + expect "clic => " + + send "r\n" + expect "clic => " + + send "help\n" + expect "clic => " + + send "5\n" + expect "clic => " + + send "p\n" + expect "clic => " + + send "19\n" + expect " : " + + send "p\n" + expect "clic => " + + send "h\n" + expect "clic => " + + send "a\n" + expect "clic => " + + send "b\n" + expect "clic => " +} + +spawn ./clic gopher://bitreich.org +set running [user_input] +send "x\n" +expect eof + + +spawn sbcl +expect "* " + +send "(require :sb-cover) (require :sb-bsd-sockets)\n" +expect "* " + +send "(declaim (optimize sb-cover:store-coverage-data))\n" +expect "* " + +send "(compile-file \"clic.lisp\")\n" +expect "* " + +send "(load \"clic.fasl\")\n" +expect "* " + +send "(setf *offline* t)\n" +expect "* " + +send "(main)\n" +set running [user_input] +send "quit\n" +expect "* " + +send "(main)\n" +expect "clic => " + +send "q\n" +expect "* " + +send "(pop *history*) (p) (r)\n" +expect "* " + + +# add an argv to test argv parsing +send "(setf *posix-argv* '(\"sbcl\" \"gopher://bitreich.org/0/usr/\"))\n" +expect "* " + +send "(main)\n" +expect "* " + + +# add an argv to test argv parsing +send "(setf *posix-argv* '(\"sbcl\" \"bitreich.org/0/usr/\"))\n" +expect "* " +send "(main)\n" +expect "* " + + + +# add an argv to test argv parsing +send "(setf *posix-argv* '(\"sbcl\" \"bitreich.org:70/\"))\n" +expect "* " +send "(main)\n" +expect "clic => " +send "q\n" +expect "* " + + +send "(sb-cover:report \"report/\")\n" +expect "* " + +send "(quit)\n" +expect eof DIR diff --git a/run-test.sh b/run-test.sh @@ -2,6 +2,8 @@ LISP=$1 +expect -f interactive-test.exp + ${LISP} --load clic.lisp --load test.lisp ./clic gopher://bitreich.org:70/0/ | md5sum -