File: smoke-compile.bash

package info (click to toggle)
inform6-compiler 6.33-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 1,672 kB
  • ctags: 2,537
  • sloc: ansic: 28,395; makefile: 60; sh: 48
file content (38 lines) | stat: -rw-r--r-- 1,239 bytes parent folder | download
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 :