From: senhuang42 Date: Thu, 24 Sep 2020 20:44:33 +0000 (-0400) Subject: Update unit tests X-Git-Tag: v1.4.7~68^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f7212a48bcaade4e4e8c6431ed065fe33be5ba1;p=thirdparty%2Fzstd.git Update unit tests --- diff --git a/programs/fileio.c b/programs/fileio.c index bfcb58c27..3ee338677 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -542,7 +542,7 @@ void FIO_setNbFilesTotal(FIO_ctx_t* const fCtx, int value) } void FIO_determineHasStdinInput(FIO_ctx_t* const fCtx, const FileNamesTable* const filenames) { - int i = 0; + size_t i = 0; for ( ; i < filenames->tableSize; ++i) { if (!strcmp(stdinmark, filenames->fileNames[i])) { fCtx->hasStdinInput = 1; diff --git a/tests/playTests.sh b/tests/playTests.sh index aee790da5..e55b02f1f 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -311,13 +311,19 @@ println "Test completed" -println "\n===> warning prompt does not swallow characters" +println "\n===> warning prompts should not occur if stdin is an input" println "y" > tmpPrompt println "hello world" >> tmpPrompt -zstd tmpPrompt -zstd < tmpPrompt -o tmpPrompt.zst -zstd -q -d tmpPrompt.zst -o tmpPromptRegenerated -$DIFF tmpPromptRegenerated tmpPrompt +zstd tmpPrompt -f +zstd < tmpPrompt -o tmpPrompt.zst && die "should have aborted immediately and failed to overwrite" +zstd < tmpPrompt -o tmpPrompt.zst -f # should successfully overwrite with -f +zstd -q -d -f tmpPrompt.zst -o tmpPromptRegenerated +$DIFF tmpPromptRegenerated tmpPrompt # the first 'y' character should not be swallowed + +echo 'yes' | zstd tmpPrompt -o tmpPrompt.zst # accept piped "y" input to force overwrite when using files +echo 'yes' | zstd < tmpPrompt -o tmpPrompt.zst && die "should have aborted immediately and failed to overwrite" +zstd tmpPrompt - < tmpPrompt -o tmpPromp.zst --rm && die "should have aborted immediately and failed to remove" + println "Test completed"