1168 |
15 Aug 10 |
peter |
// $Id$ |
1168 |
15 Aug 10 |
peter |
2 |
|
1168 |
15 Aug 10 |
peter |
3 |
/* |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2010 Peter Johansson |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2012 Jari Häkkinen, Peter Johansson |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2023 Peter Johansson |
1168 |
15 Aug 10 |
peter |
7 |
|
1168 |
15 Aug 10 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
1168 |
15 Aug 10 |
peter |
9 |
|
1168 |
15 Aug 10 |
peter |
svndigest is free software; you can redistribute it and/or modify it |
1168 |
15 Aug 10 |
peter |
under the terms of the GNU General Public License as published by |
1168 |
15 Aug 10 |
peter |
the Free Software Foundation; either version 3 of the License, or |
1168 |
15 Aug 10 |
peter |
(at your option) any later version. |
1168 |
15 Aug 10 |
peter |
14 |
|
1168 |
15 Aug 10 |
peter |
svndigest is distributed in the hope that it will be useful, but |
1168 |
15 Aug 10 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
1168 |
15 Aug 10 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1168 |
15 Aug 10 |
peter |
General Public License for more details. |
1168 |
15 Aug 10 |
peter |
19 |
|
1168 |
15 Aug 10 |
peter |
You should have received a copy of the GNU General Public License |
1168 |
15 Aug 10 |
peter |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
1168 |
15 Aug 10 |
peter |
22 |
*/ |
1168 |
15 Aug 10 |
peter |
23 |
|
1619 |
12 Mar 23 |
peter |
24 |
#include <config.h> |
1619 |
12 Mar 23 |
peter |
25 |
|
1168 |
15 Aug 10 |
peter |
26 |
#include "Suite.h" |
1168 |
15 Aug 10 |
peter |
27 |
|
1168 |
15 Aug 10 |
peter |
28 |
#include "lib/SVN.h" |
1540 |
10 Oct 12 |
peter |
29 |
#include "lib/SVNcat.h" |
1168 |
15 Aug 10 |
peter |
30 |
|
1543 |
13 Oct 12 |
jari |
31 |
#include <cassert> |
1168 |
15 Aug 10 |
peter |
32 |
#include <cstdlib> |
1542 |
11 Oct 12 |
peter |
33 |
#include <fstream> |
1168 |
15 Aug 10 |
peter |
34 |
#include <ostream> |
1542 |
11 Oct 12 |
peter |
35 |
#include <sstream> |
1168 |
15 Aug 10 |
peter |
36 |
#include <string> |
1168 |
15 Aug 10 |
peter |
37 |
|
1168 |
15 Aug 10 |
peter |
38 |
using namespace theplu::svndigest; |
1168 |
15 Aug 10 |
peter |
39 |
|
1168 |
15 Aug 10 |
peter |
40 |
int main(int argc, char* argv[]) |
1168 |
15 Aug 10 |
peter |
41 |
{ |
1168 |
15 Aug 10 |
peter |
42 |
test::Suite suite(argc, argv, true); |
1168 |
15 Aug 10 |
peter |
43 |
SVN* svn=SVN::instance("toy_project"); |
1541 |
10 Oct 12 |
peter |
44 |
if (!svn) { |
1168 |
15 Aug 10 |
peter |
45 |
suite.out() << "error: cannot create SVN instance\n"; |
1168 |
15 Aug 10 |
peter |
46 |
return EXIT_FAILURE; |
1168 |
15 Aug 10 |
peter |
47 |
} |
1168 |
15 Aug 10 |
peter |
48 |
|
1542 |
11 Oct 12 |
peter |
49 |
suite.system("svn cat -r 5 toy_project/README > README-r5"); |
1542 |
11 Oct 12 |
peter |
50 |
std::ifstream is("README-r5"); |
1542 |
11 Oct 12 |
peter |
51 |
assert(is); |
1547 |
20 Oct 12 |
peter |
52 |
std::string line; |
1547 |
20 Oct 12 |
peter |
// avoid first line |
1547 |
20 Oct 12 |
peter |
54 |
getline(is, line, '\n'); |
1547 |
20 Oct 12 |
peter |
// read remaining file |
1547 |
20 Oct 12 |
peter |
56 |
getline(is, line, '\0'); |
1548 |
20 Oct 12 |
peter |
57 |
std::string str = "$I" "d$\n" + line; |
1542 |
11 Oct 12 |
peter |
58 |
is.close(); |
1168 |
15 Aug 10 |
peter |
59 |
|
1542 |
11 Oct 12 |
peter |
60 |
SVNcat readme("toy_project/README", 5); |
1547 |
20 Oct 12 |
peter |
61 |
suite.out() << "README rev 5:\n" << readme.str() << "\n"; |
1542 |
11 Oct 12 |
peter |
62 |
|
1542 |
11 Oct 12 |
peter |
63 |
suite.out() << "comparing 'svn cat' with SVNcat string:\n"; |
1542 |
11 Oct 12 |
peter |
64 |
if (test::diff(str, readme.str())) |
1542 |
11 Oct 12 |
peter |
65 |
suite.add(false); |
1542 |
11 Oct 12 |
peter |
66 |
|
1168 |
15 Aug 10 |
peter |
67 |
return suite.exit_status(); |
1168 |
15 Aug 10 |
peter |
68 |
} |
1168 |
15 Aug 10 |
peter |
69 |
|