blob: 6b7ba90e3701c1891c306406fb73ef708bfe491a [file] [log] [blame]
Dave MacLachlan48006262016-02-03 23:31:39 +00001#!/bin/bash
2
3# Copyright 2016 The Bazel Authors. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http:#www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17set -eu
18
19# This allows RUNFILES to be declared outside the script it you want.
20# RUNFILES for test is the directory of the script.
21RUNFILES=${RUNFILES:-$($(cd $(dirname ${BASH_SOURCE[0]})); pwd)}
22
23source "${RUNFILES}/examples/shell/lib.sh"
24
25function test_output {
26 OUTPUT=$(showfile)
27 EXPECTED_OUTPUT=$(cat "${RUNFILES}/examples/shell/data/test_file.txt")
28
29 if [ "${OUTPUT}" != "${EXPECTED_OUTPUT}" ]; then
30 # This would be a failure case.
31 exit 1
32 fi
33}
34
35test_output