From eddbb4497da928fbab743879384056b6300e9cbb Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Wed, 22 Jan 2014 20:50:33 -0500 Subject: [PATCH] tests: Source image header in a subshell. Use a subshell when sourcing the image header in pam-formats so that the shell variables do not persist past the end of the test. While unlikely, a value left over from an earlier test might result in false positives in later tests. --- tests/pam-formats.tap | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/pam-formats.tap b/tests/pam-formats.tap index 42f3892..76c0185 100755 --- a/tests/pam-formats.tap +++ b/tests/pam-formats.tap @@ -2,7 +2,7 @@ # # 2ooM: The Master of Orion II Reverse Engineering Project # Test that the PAM writer emits the smallest output format. -# Copyright © 2013 Nick Bowler +# Copyright © 2013-2014 Nick Bowler # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,25 +19,25 @@ . "$srcdir/tests/util/test-init.sh" || exit 99 -plan_ 8 dx_create_testdir +plan_ 8 -check_image() -{ +check_image() { dx_pam_header "$1" > "$1.sh" || return - . "./$1.sh" || return - - test x"$WIDTH" = x"1" || return - test x"$HEIGHT" = x"1" || return - test x"$DEPTH" = x"$2" || return - - case $DEPTH in - 1) test x"$TUPLTYPE" = x"GRAYSCALE" ;; - 2) test x"$TUPLTYPE" = x"GRAYSCALE_ALPHA" ;; - 3) test x"$TUPLTYPE" = x"RGB" ;; - 4) test x"$TUPLTYPE" = x"RGB_ALPHA" ;; - *) false - esac + ( . "./$1.sh" || exit + + test x"$WIDTH" = x"1" || exit + test x"$HEIGHT" = x"1" || exit + test x"$DEPTH" = x"$2" || exit + + case $DEPTH in + 1) test x"$TUPLTYPE" = x"GRAYSCALE" ;; + 2) test x"$TUPLTYPE" = x"GRAYSCALE_ALPHA" ;; + 3) test x"$TUPLTYPE" = x"RGB" ;; + 4) test x"$TUPLTYPE" = x"RGB_ALPHA" ;; + *) false + esac + ) } command_ok_ "decoding image-1x1 (no palette)" \ -- 2.43.0