Source

text / tests / cover-stdio.sh

#!/bin/bash

exe=./stdio-hpc

rm -f $exe.tix

f=$(mktemp stdio-f.XXXXXX)
g=$(mktemp stdio-g.XXXXXX)

for t in T TL; do
    echo $t.readFile > $f
    $exe $t.readFile $f > $g
    if ! diff -u $f $g; then
	errs=$((errs+1))
	echo FAIL: $t.readFile 1>&2
    fi

    $exe $t.writeFile $f $t.writeFile
    echo -n $t.writeFile > $g
    if ! diff -u $f $g; then
	errs=$((errs+1))
	echo FAIL: $t.writeFile 1>&2
    fi

    echo -n quux > $f
    $exe $t.appendFile $f $t.appendFile
    echo -n quux$t.appendFile > $g
    if ! diff -u $f $g; then
	errs=$((errs+1))
	echo FAIL: $t.appendFile 1>&2
    fi

    echo $t.interact | $exe $t.interact > $f
    echo $t.interact > $g
    if ! diff -u $f $g; then
	errs=$((errs+1))
	echo FAIL: $t.interact 1>&2
    fi

    echo $t.getContents | $exe $t.getContents > $f
    echo $t.getContents > $g
    if ! diff -u $f $g; then
	errs=$((errs+1))
	echo FAIL: $t.getContents 1>&2
    fi

    echo $t.getLine | $exe $t.getLine > $f
    echo $t.getLine > $g
    if ! diff -u $f $g; then
	errs=$((errs+1))
	echo FAIL: $t.getLine 1>&2
    fi
done

rm -f $f $g

exit $errs
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.