#!/bin/bash # Check that output is a valid ruby script when number of concatenated # files is fewer than 5, and output should be empty. We make no # promises on what happens when 6 or more files are concatenated, # because we would have already gotten some output at the 5th file. set -euo pipefail if [[ $# -ne 5 ]]; then echo "$0 " exit 1 fi ANGE=$1 CHARLOTTE=$2 DOROTHY=$3 BEATRICE=$4 CHISE=$5 function test_empty { if ! ( cat $@ | ruby | diff -q /dev/null - ); then echo "Unexpected output for order $@" exit 1 fi } test_empty $ANGE test_empty $CHARLOTTE test_empty $DOROTHY test_empty $BEATRICE test_empty $CHISE test_empty $ANGE $CHARLOTTE test_empty $CHARLOTTE $DOROTHY test_empty $DOROTHY $BEATRICE test_empty $BEATRICE $CHISE test_empty $CHISE $ANGE test_empty $DOROTHY $CHARLOTTE $ANGE test_empty $BEATRICE $DOROTHY $CHARLOTTE test_empty $CHISE $BEATRICE $DOROTHY test_empty $ANGE $CHISE $BEATRICE test_empty $CHARLOTTE $ANGE $CHISE test_empty $CHARLOTTE $ANGE $DOROTHY $CHISE test_empty $DOROTHY $CHARLOTTE $BEATRICE $ANGE test_empty $BEATRICE $DOROTHY $CHISE $CHARLOTTE test_empty $CHISE $BEATRICE $ANGE $DOROTHY test_empty $ANGE $CHISE $CHARLOTTE $BEATRICE exit 0