source: trunk/test/cache_partial_test.cc @ 1104

Last change on this file since 1104 was 1104, checked in by Peter Johansson, 11 years ago

fixes #459. The problem was that we now run the test in a subdir of
test and some path had not been updated.

Also fix a bug in Makefile.am that directory, .toy_project, was
removed with 'rm -f'; you need -r switch to remove directories. The
directory should not be generated anymore so I removed it from list of
files to remove.

In Suite.cc added an output in start of test that we are running
foo_test in testSubDir/foo_test.dir.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1// $Id: cache_partial_test.cc 1104 2010-06-15 22:50:46Z peter $
2
3/*
4  Copyright (C) 2009, 2010 Peter Johansson
5
6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
7
8  svndigest is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12
13  svndigest is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22// Testing that partial cache works fine, ticket #338.
23
24#include "Suite.h"
25
26#include "File.h"
27#include "SVN.h"
28#include "SVNinfo.h"
29
30#include "../lib/utility.h"
31
32#include <iostream>
33
34using namespace theplu::svndigest;
35
36int main( int argc, char* argv[])
37{
38  test::Suite suite(argc, argv, true);
39
40  mkdir_p("toy_project/.svndigest");
41  std::string root="toy_project";
42  std::string filename = root + "/AUTHORS";
43  suite.out() << "Create SVN instance" << std::endl;
44  SVN* svn=SVN::instance(root);
45  if (!svn)
46    return 1;
47  // Extract repository location
48  suite.out() << "Extract repository location" << std::endl;
49  std::string repo=SVNinfo(root).repos_root_url();
50
51  // create file ignoring cache file
52  std::string cache_file = "toy_project/.svndigest/AUTHORS.svndigest-cache";
53  File file(0,filename,"");
54  const StatsCollection& stats1 = file.parse(suite.verbose(), true);
55  suite.add(test::consistent(stats1, suite));
56
57  // create file using partial cache
58  copy_file(test::src_filename("data/AUTHORS.svndigest-cache-r61"), cache_file);
59  File file2(0,filename,"");
60  const StatsCollection& stats2 = file2.parse(suite.verbose(), false);
61  suite.add(test::consistent(stats2, suite));
62
63  suite.add(equal(stats1, stats2, suite));
64
65  if (suite.ok()) {
66    suite.out() << "Test is OK\n";
67    return 0;
68  }
69  suite.out() << "Test failed\n";
70  return 1;
71}
72
73
74
75
Note: See TracBrowser for help on using the repository browser.