// $Id$
/*
Copyright (C) 2008 Jari Häkkinen, Peter Johansson
Copyright (C) 2009, 2010, 2011 Peter Johansson
This file is part of svndigest, http://dev.thep.lu.se/svndigest
svndigest is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
svndigest is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with svndigest. If not, see .
*/
#include "Suite.h"
#include "lib/Configuration.h"
#include "lib/File.h"
#include "lib/main_utility.h"
#include "lib/SVN.h"
#include "lib/SVNinfo.h"
#include "lib/utility.h"
#include
#include
#include
#include
#include
#include
std::vector copyright_lines(std::istream&);
int main( int argc, char* argv[])
{
using namespace theplu::svndigest;
test::Suite suite(argc, argv, true);
std::string root="toy_project";
std::string filename = root + "/README";
// Saving original file
std::ifstream is(filename.c_str());
assert(is.good());
std::string original_file;
std::getline(is, original_file, '\0');
is.close();
is.clear(std::ios::goodbit);
is.open(filename.c_str());
std::vector copyrights_old=copyright_lines(is);
is.close();
is.clear(std::ios::goodbit);
if (copyrights_old.size()!=1) {
suite.out() << copyrights_old.size() << " Copyright lines\n";
for (size_t i=0; i copyrights=copyright_lines(is);
is.close();
is.clear(std::ios::goodbit);
std::vector copyright_correct;
copyright_correct.push_back("Copyright (C) 2006 jh");
copyright_correct.push_back("Copyright (C) 2008 pj");
if (copyrights.size()!=copyright_correct.size()) {
suite.add(false);
suite.out() << "ERROR: expected " << copyright_correct.size()
<< " lines of Copyright (C)\n"
<< "But found " << copyrights.size() << " lines.\n";
for (size_t i=0; i copyright_lines(std::istream& is)
{
using namespace theplu::svndigest;
std::vector res;
std::string line;
while (std::getline(is, line)){
if (match_begin(line.begin(), line.end(), "Copyright (C)"))
res.push_back(line);
}
return res;
}