rollback-extras.t 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright (C) 2013 Alex Schroeder <alex@gnu.org>
  2. #
  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
  6. # version.
  7. #
  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.
  11. #
  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/>.
  14. require './t/test.pl';
  15. package OddMuse;
  16. use Test::More tests => 3;
  17. # simple, single page rollback
  18. # ($ts, $id, $minor, $summary, $host, $username, $revision, $languages, $cluster)
  19. # ($ts, '[[rollback]]', $to, $page)
  20. WriteStringToFile ($RcFile, "1Aone1\n"); # original
  21. AppendStringToFile($RcFile, "2Atwo2\n"); # to be rolled back
  22. AppendStringToFile($RcFile, "3A0one3\n"); # back to the original
  23. AppendStringToFile($RcFile, "3[[rollback]]1A\n"); # rollback marker
  24. local $/ = "\n"; # undef in test.pl
  25. my @lines = GetRcLines(1);
  26. is(scalar(@lines), 1, "starting situation contains just one line");
  27. is($lines[0][0], 3, "simple rollback starts with 3");
  28. AppendStringToFile($RcFile, "4Athree4\n");
  29. # print "GetRcLines\n";
  30. # for my $line (GetRcLines(1)) {
  31. # my ($ts, $id, $minor, $summary) = @$line;
  32. # print "$ts, $id, $minor, $summary\n";
  33. # }
  34. SetParam('all', 1);
  35. my @lines = GetRcLines(1);
  36. is(scalar(@lines), 4, "using all=1, see all four major revisions");
  37. # This could be an interesting test framework.