#!/usr/bin/env bats load bats-extra # local version: 1.4.0.0 # Your bash program should be able to accept input # 1. via standard input, OR # 2. as a filename given on the cmd line. # uses external tool: mktemp setup() { export INPUT_FILE HAS_TTY INPUT_FILE=$( mktemp ) [[ -t 0 ]] && HAS_TTY=1 || HAS_TTY=0 } teardown() { rm -f "$INPUT_FILE"; } @test "just the header if no input" { #[[ $BATS_RUN_SKIPPED == "true" ]] || skip input=$( cat <"$INPUT_FILE" Allegoric Alaskans;Blithering Badgers;win INPUT expected=$( cat < "$INPUT_FILE" Allegoric Alaskans;Blithering Badgers;loss Devastating Donkeys;Allegoric Alaskans;loss Courageous Californians;Blithering Badgers;draw Allegoric Alaskans;Courageous Californians;win INPUT expected=$( cat <