1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
# debian/tests/smoke-compile.sh
# Part of Debian ‘inform6-compiler’ package.
#
# Copyright © 2016 Ben Finney <bignose@debian.org>
# This is free software; you may copy, modify, and/or distribute this
# work under the terms of the GNU General Public License as published
# by the Free Software Foundation; version 3 of that License or later.
# No warranty expressed or implied.
#
# Common functionality for compiler smoke tests.
document_source_file="${DOCUMENT_NAME}".inf
document_source_path="debian/tests/${document_source_file}"
document_file="${DOCUMENT_NAME}"${DOCUMENT_SUFFIX}
document_path="debian/tests/${document_file}"
function compile_document() {
inform6 ${INFORM_OPTS} ${document_source_path} ${document_path}
}
function assert_file_type() {
local expected_type_pattern="$1"
local expected_output_pattern="^${document_path}: ${expected_type_pattern}$"
file_type="$(file "${document_path}")"
printf "File type output: “%s”\n" "${file_type}"
printf "Expected pattern: “%s”\n" "${expected_output_pattern}"
grep -q "${expected_output_pattern}" <(printf "%s\n" "${file_type}")
}
# Local variables:
# coding: utf-8
# mode: shell-script
# End:
# vim: fileencoding=utf-8 filetype=sh :
|