From e15a09840ea537b3b41efaae940ad022662db75d Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 22 Sep 2016 21:22:57 +0000 Subject: [PATCH] dev tools: Automate a recurring step: Set year correctly for new tests. --- tests/generate.zsh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/generate.zsh b/tests/generate.zsh index 3eee487..4b21587 100755 --- a/tests/generate.zsh +++ b/tests/generate.zsh @@ -40,8 +40,10 @@ if (( $# != 3 )) || [[ $1 == -* ]]; then fi buffer=$1 ZSH_HIGHLIGHT_HIGHLIGHTERS=( $2 ) -exec >${0:A:h:h}/highlighters/$2/test-data/$3.zsh -git add -N ${0:A:h:h}/highlighters/$2/test-data/$3.zsh +fname=${0:A:h:h}/highlighters/$2/test-data/$3.zsh +exec 3>&1 +exec >$fname +git add -N $fname # Load the main script. . ${0:A:h:h}/zsh-syntax-highlighting.zsh @@ -85,3 +87,10 @@ print 'expected_region_highlight=(' done } print ')' + +exec >&3 +year="`LC_ALL=C date +%Y`" +if read -q "?Set copyright year to $year? "; then + <$fname >$fname.t sed s/YYYY/$year/ && + mv $fname.t $fname +fi