1 # Copyright (C) 2013 Alex Schroeder <alex@gnu.org>
3 # This program is free software: you can redistribute it and/or modify it under
4 # the terms of the GNU General Public License as published by the Free Software
5 # Foundation, either version 3 of the License, or (at your option) any later
8 # This program is distributed in the hope that it will be useful, but WITHOUT
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License along with
13 # this program. If not, see <http://www.gnu.org/licenses/>.
17 use Test::More tests => 3;
19 # simple, single page rollback
21 # ($ts, $id, $minor, $summary, $host, $username, $revision, $languages, $cluster)
22 # ($ts, '[[rollback]]', $to, $page)
25 WriteStringToFile ($RcFile, "1
\x1eA
\x1e\x1eone
\x1e\x1e\x1e1
\x1e\x1e\n"); # original
26 AppendStringToFile($RcFile, "2
\x1eA
\x1e\x1etwo
\x1e\x1e\x1e2
\x1e\x1e\n"); # to be rolled back
27 AppendStringToFile($RcFile, "3
\x1eA
\x1e0
\x1eone
\x1e\x1e\x1e3
\x1e\x1e\n"); # back to the original
28 AppendStringToFile($RcFile, "3
\x1e[[rollback]]
\x1e1
\x1eA
\x1e\x1e\x1e\x1e\x1e\n"); # rollback marker
30 local $/ = "\n"; # undef in test.pl
32 my @lines = GetRcLines(1);
33 is(scalar(@lines), 1, "starting situation contains just one line");
34 is($lines[0][0], 3, "simple rollback starts with 3");
36 AppendStringToFile($RcFile, "4
\x1eA
\x1e\x1ethree
\x1e\x1e\x1e4
\x1e\x1e\n");
38 # print "GetRcLines\n";
39 # for my $line (GetRcLines(1)) {
40 # my ($ts, $id, $minor, $summary) = @$line;
41 # print "$ts, $id, $minor, $summary\n";
45 my @lines = GetRcLines(1);
46 is(scalar(@lines), 4, "using all=1, see all four major revisions");
49 # This could be an interesting test framework.