Re: [PATCH 1/1] tests: Allow customization of how say_color() prints

2012-12-17 Thread Junio C Hamano
Ramsay Jones ram...@ramsay1.demon.co.uk writes:

 Junio C Hamano wrote:
 ...
 Why does your printf die in the first place???

 I really don't know. ...

 Sorry for wasting your time.

Not a waste. I was hoping somebody (not necessarily you) may be able
to come up with a cleaner solution.  Unfortunately it hasn't
happened (yet), but discussing issues on the list is often not a
waste.

We could introduce git_test_print and git_test_println shell
functions that default to the current printf, and let the users
override these by including a custom scriptllet from t/test-lib.sh,
or something.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] tests: Allow customization of how say_color() prints

2012-12-15 Thread Junio C Hamano
Ramsay Jones ram...@ramsay1.demon.co.uk writes:

 diff --git a/t/test-lib.sh b/t/test-lib.sh
 index f50f834..9dcf3c1 100644
 --- a/t/test-lib.sh
 +++ b/t/test-lib.sh
 @@ -202,6 +202,15 @@ do
   esac
  done
  
 +if test -z $GIT_TEST_PRINT
 +then
 + GIT_TEST_PRINT=printf %s
 +fi
 +if test -z $GIT_TEST_PRINT_LN
 +then
 + GIT_TEST_PRINT_LN=printf %s\n
 +fi
 +
  if test -n $color
  then
   say_color () {
 @@ -221,7 +230,7 @@ then
   test -n $quiet  return;;
   esac
   shift
 - printf %s $*
 + $GIT_TEST_PRINT $*
   tput sgr0
   echo
   )
 @@ -230,7 +239,7 @@ else
   say_color() {
   test -z $1  test -n $quiet  return
   shift
 - printf %s\n $*
 + $GIT_TEST_PRINT_LN $*
   }
  fi

As you said, this is ugly and also unwieldy in that I do not see an
easy way for a platform/builder to define something that needs to
pass a parameter with $IFS in it in these two variables.

Why does your printf die in the first place???

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html