#!/bin/bash

. common


#---------------------------------------------
# test MST_AM_INIT

test_initialize
test_result_hook result_hook


#---------------
# test mst_program_prefix

test_begin_subtests

prefix='MST_AM_INIT: program_prefix=NONE'
output_file="$(testpfx)_output"
echo "@mst_program_prefix@" > $output_file.in
config_str "$prefix"			\
    'MST_AM_INIT'	\
    "AC_CONFIG_FILES($output_file)"

run_test "$prefix"
if [ $test_status -eq 0 ]; then
    output=$(< $output_file)
    test_is "$output" '' "$prefix: output"
else
    test_skip "$prefix: configure failed; skipping output check" 1
fi

test_end_subtests

test_begin_subtests

prefix='MST_AM_INIT: program_prefix=g'
output_file="$(testpfx)_output"
echo "@mst_program_prefix@" > $output_file.in
config_str "$prefix"			\
    'MST_AM_INIT'	\
    "AC_CONFIG_FILES($output_file)"

run_test "$prefix" --program-prefix=g
if [ $test_status -eq 0 ]; then
    output=$(< $output_file)
    test_is "$output" 'g' "$prefix: output"
else
    test_skip "$prefix: configure failed; skipping output check" 1
fi

test_end_subtests

test_summary
test_exit
