1 # Copyright (C) 2006 Alex Schroeder <alex@emacswiki.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the
15 # Free Software Foundation, Inc.
16 # 59 Temple Place, Suite 330
17 # Boston, MA 02111-1307 USA
21 use Test::More tests => 64;
26 update_page('bar', 'one', '', 1); # lastmajor is undef
27 test_page(get_page('action=browse id=bar diff=1'), 'No diff available', 'one', 'Last major edit',
28 'diff=1;id=bar;diffrevision=1');
29 test_page(get_page('action=browse id=bar diff=2'), 'No diff available', 'one', 'Last edit');
30 update_page('bar', 'two', '', 1); # lastmajor is undef
31 test_page(get_page('action=browse id=bar diff=1'), 'No diff available', 'two', 'Last major edit',
32 'diff=1;id=bar;diffrevision=1');
33 test_page(get_page('action=browse id=bar diff=2'), 'one', 'two', 'Last edit');
34 update_page('bar', 'three'); # lastmajor is 3
35 test_page(get_page('action=browse id=bar diff=1'), 'two', 'three', 'Last edit');
36 test_page(get_page('action=browse id=bar diff=2'), 'two', 'three', 'Last edit');
37 update_page('bar', 'four'); # lastmajor is 4
38 test_page(get_page('action=browse id=bar diff=1'), 'three', 'four', 'Last edit');
39 test_page(get_page('action=browse id=bar diff=2'), 'three', 'four', 'Last edit');
44 update_page('bla', 'one'); # lastmajor is 1
45 test_page(get_page('action=browse id=bla diff=1'), 'No diff available', 'one', 'Last edit');
46 test_page(get_page('action=browse id=bla diff=2'), 'No diff available', 'one', 'Last edit');
47 update_page('bla', 'two', '', 1); # lastmajor is 1
48 test_page(get_page('action=browse id=bla diff=1'), 'No diff available', 'two', 'Last major edit',
49 'diff=1;id=bla;diffrevision=1');
50 test_page(get_page('action=browse id=bla diff=2'), 'one', 'two', 'Last edit');
51 update_page('bla', 'three'); # lastmajor is 3
52 test_page(get_page('action=browse id=bla diff=1'), 'two', 'three', 'Last edit');
53 test_page(get_page('action=browse id=bla diff=2'), 'two', 'three', 'Last edit');
54 update_page('bla', 'four', '', 1); # lastmajor is 3
55 test_page(get_page('action=browse id=bla diff=1'), 'two', 'three', 'Last major edit',
56 'diff=1;id=bla;diffrevision=3');
57 test_page(get_page('action=browse id=bla diff=2'), 'three', 'four', 'Last edit');
58 update_page('bla', 'five'); # lastmajor is 5
59 test_page(get_page('action=browse id=bla diff=1'), 'four', 'five', 'Last edit');
60 test_page(get_page('action=browse id=bla diff=2'), 'four', 'five', 'Last edit');
61 update_page('bla', 'six'); # lastmajor is 6
62 test_page(get_page('action=browse id=bla diff=1'), 'five', 'six', 'Last edit');
63 test_page(get_page('action=browse id=bla diff=2'), 'five', 'six', 'Last edit');