major.t 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Copyright (C) 2006–2015 Alex Schroeder <alex@gnu.org>
  2. #
  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 3 of the License, or
  6. # (at your option) any later version.
  7. #
  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.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. require './t/test.pl';
  16. package OddMuse;
  17. use Test::More tests => 60;
  18. # start with minor
  19. update_page('bar', 'one', '', 1); # lastmajor is undef
  20. test_page(get_page('action=browse id=bar diff=1'), 'No diff available', 'one');
  21. test_page(get_page('action=browse id=bar diff=2'), 'No diff available', 'one', 'Last edit');
  22. update_page('bar', 'two', '', 1); # lastmajor is undef
  23. test_page(get_page('action=browse id=bar diff=1'), 'No diff available', 'two');
  24. test_page(get_page('action=browse id=bar diff=2'), 'one', 'two', 'Last edit');
  25. update_page('bar', 'three'); # lastmajor is 3
  26. test_page(get_page('action=browse id=bar diff=1'), 'two', 'three', 'Last edit');
  27. test_page(get_page('action=browse id=bar diff=2'), 'two', 'three', 'Last edit');
  28. update_page('bar', 'four'); # lastmajor is 4
  29. test_page(get_page('action=browse id=bar diff=1'), 'three', 'four', 'Last edit');
  30. test_page(get_page('action=browse id=bar diff=2'), 'three', 'four', 'Last edit');
  31. # start with major
  32. clear_pages();
  33. update_page('bla', 'one'); # lastmajor is 1
  34. test_page(get_page('action=browse id=bla diff=1'), 'No diff available', 'one', 'Last edit');
  35. test_page(get_page('action=browse id=bla diff=2'), 'No diff available', 'one', 'Last edit');
  36. update_page('bla', 'two', '', 1); # lastmajor is 1
  37. test_page(get_page('action=browse id=bla diff=1'), 'No diff available', 'two', 'Last major edit',
  38. 'diff=2;id=bla;diffrevision=1');
  39. test_page(get_page('action=browse id=bla diff=2'), 'one', 'two', 'Last edit');
  40. update_page('bla', 'three'); # lastmajor is 3
  41. test_page(get_page('action=browse id=bla diff=1'), 'two', 'three', 'Last edit');
  42. test_page(get_page('action=browse id=bla diff=2'), 'two', 'three', 'Last edit');
  43. update_page('bla', 'four', '', 1); # lastmajor is 3
  44. test_page(get_page('action=browse id=bla diff=1'), 'two', 'three', 'Last major edit',
  45. 'diff=2;id=bla;diffrevision=3');
  46. test_page(get_page('action=browse id=bla diff=2'), 'three', 'four', 'Last edit');
  47. update_page('bla', 'five'); # lastmajor is 5
  48. test_page(get_page('action=browse id=bla diff=1'), 'four', 'five', 'Last edit');
  49. test_page(get_page('action=browse id=bla diff=2'), 'four', 'five', 'Last edit');
  50. update_page('bla', 'six'); # lastmajor is 6
  51. test_page(get_page('action=browse id=bla diff=1'), 'five', 'six', 'Last edit');
  52. test_page(get_page('action=browse id=bla diff=2'), 'five', 'six', 'Last edit');