Update unit tests

This commit is contained in:
senhuang42 2020-09-24 16:44:33 -04:00
parent 88f4410390
commit 9f7212a48b
2 changed files with 12 additions and 6 deletions

View File

@ -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) { void FIO_determineHasStdinInput(FIO_ctx_t* const fCtx, const FileNamesTable* const filenames) {
int i = 0; size_t i = 0;
for ( ; i < filenames->tableSize; ++i) { for ( ; i < filenames->tableSize; ++i) {
if (!strcmp(stdinmark, filenames->fileNames[i])) { if (!strcmp(stdinmark, filenames->fileNames[i])) {
fCtx->hasStdinInput = 1; fCtx->hasStdinInput = 1;

View File

@ -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 "y" > tmpPrompt
println "hello world" >> tmpPrompt println "hello world" >> tmpPrompt
zstd tmpPrompt zstd tmpPrompt -f
zstd < tmpPrompt -o tmpPrompt.zst zstd < tmpPrompt -o tmpPrompt.zst && die "should have aborted immediately and failed to overwrite"
zstd -q -d tmpPrompt.zst -o tmpPromptRegenerated zstd < tmpPrompt -o tmpPrompt.zst -f # should successfully overwrite with -f
$DIFF tmpPromptRegenerated tmpPrompt 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" println "Test completed"