source: trunk/test/copyright_cache_test.sh @ 1364

Last change on this file since 1364 was 1364, checked in by Peter Johansson, 10 years ago

adding test for copyright cache. refs #385.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1#!/bin/sh
2
3# $Id: copyright_cache_test.sh 1364 2011-06-05 00:01:14Z peter $
4
5# Copyright (C) 2011 Peter Johansson
6#
7# This file is part of svndigest, http://dev.thep.lu.se/svndigest
8#
9# svndigest is free software; you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 3 of the License, or
12# (at your option) any later version.
13#
14# svndigest is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17# General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
21
22required="repo"
23
24. ./init.sh || exit 1
25
26# exit if cmd fails
27set -e
28
29file=Credits.txt
30cache_dir=$rootdir/alhambra/.svndigest
31cache_file=$cache_dir/${file}.svncopyright-cache
32rm -f $cache_file
33
34# mini config file
35cat > config <<EOF
36[copyright-alias]
37jari = Jari Häkkinen
38peter = Peter Johansson
39EOF
40
41$SVN revert -R $rootdir
42SVNCOPYRIGHT_run 0 -r $rootdir/alhambra --ignore-cache -v --config-file=config
43test -s stderr && exit_fail
44test -r $cache_file || exit_fail
45# check that we cache user name not alias
46grep peter $cache_file || exit_fail
47cp $cache_file cache.txt
48
49cat > correct.txt <<EOF
50Copyright (C) 2006 Jari Häkkinen
51Copyright (C) 2009 Peter Johansson
52EOF
53grep 'Copyright (C)' $rootdir/alhambra/$file > copyright.txt || exit_fail
54diff -u correct.txt copyright.txt || exit_fail
55
56# modify the cache file to allow us to detect that it is used
57sed -i 's/peter/winston/' $cache_file
58# create a config reflecting this name change
59sed 's/peter/winston/' config > config2
60
61# copyright update using cache created above
62$SVN revert -R $rootdir
63SVNCOPYRIGHT_run 0 -r $rootdir/alhambra -v --config-file=config2
64test -s stderr && exit_fail
65grep 'Copyright (C)' $rootdir/alhambra/$file > copyright2.txt || exit_fail
66diff -u correct.txt copyright.txt || exit_fail
67
68diff -u cache.txt $cache_file || exit_fail
69
70exit_success;
Note: See TracBrowser for help on using the repository browser.