From 7acf57400157c049b730c34402466c9a72d05d80 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 9 Nov 2020 22:54:38 +0700 Subject: [PATCH] add test case for updated realpath --- tests/sftp.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/sftp.c b/tests/sftp.c index 24b52e4..d7f4de0 100644 --- a/tests/sftp.c +++ b/tests/sftp.c @@ -56,7 +56,28 @@ static char inBuf[1024] = {0}; /* return 0 on success */ static int Expected(int command) { + int i; + switch (command) { + case 3: /* pwd */ + /* working directory should not contain a '.' at the end */ + for (i = 0; i < (int)sizeof(inBuf); i++) { + if (inBuf[i] == '\n') { + inBuf[i] = '\0'; + break; + } + } + + if (inBuf[WSTRLEN(inBuf) - 2] != '/') { + printf("unexpected pwd of %s\n looking for '/'\n", inBuf); + return -1; + } + if (inBuf[WSTRLEN(inBuf) - 1] != 'a') { + printf("unexpected pwd of %s\n looking for 'a'\n", inBuf); + return -1; + } + break; + case 4: { char expt1[] = ".\n..\nwolfSSH sftp> ";