Changeset 597 for trunk/test


Ignore:
Timestamp:
Apr 15, 2008, 12:26:00 AM (13 years ago)
Author:
Peter Johansson
Message:

fixes copyright update - ticket:312

Location:
trunk/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Makefile.am

    r596 r597  
    3737
    3838# tests not yes passing are listed here
    39 XFAIL_TESTS = copyright
     39XFAIL_TESTS =
    4040
    4141noinst_HEADERS = Suite.h
  • trunk/test/copyright.cc

    r596 r597  
    3232#include <iostream>
    3333#include <fstream>
     34#include <sstream>
    3435#include <string>
    3536#include <vector>
     
    7273    std::cout << "File containes 1 copyright line.\n";
    7374
     75  // warn about missing Copyright statement only in verbose mode
     76  if (verbose){
     77    std::string config_str("[copyright]\nmissing-copyright-warning=yes");
     78    std::stringstream ss(config_str);
     79    Configuration& config = Configuration::instance();
     80    config.load(ss);
     81  }
     82
    7483  if (verbose)
    7584    std::cout << "Create SVN instance" << std::endl;
     
    93102    std::cout << "Updating copyright statements" << std::endl;
    94103  std::map<std::string, Alias> alias;
     104  alias["jari"]=Alias("jh", 1);
     105  alias["peter"]=Alias("pj", 2);
     106 
    95107  file.print_copyright(alias, verbose);
    96108
     
    100112  is.clear(std::ios::goodbit);
    101113
    102   if (copyrights.size()!=2) {
     114  std::vector<std::string> copyright_correct;
     115  copyright_correct.push_back("Copyright (C) 2006 jh");
     116  copyright_correct.push_back("Copyright (C) 2007, 2008 pj");
     117  if (copyrights.size()!=copyright_correct.size()) {
    103118    ok = false;
    104119    if (verbose)
    105       std::cout << "ERROR: expected two lines of Copyright (C)\n";
     120      std::cout << "ERROR: expected " << copyright_correct.size()
     121                << "lines of Copyright (C)\n";
    106122  }
    107   if (verbose) {
    108     std::cout << copyrights.size() << " Copyright lines:\n";
     123  else {
    109124    for (size_t i=0; i<copyrights.size(); ++i)
    110       std::cout << i+1 << ": " << copyrights[i] << "\n";
     125      if (copyrights[i]!=copyright_correct[i]){
     126        ok=false;
     127        if (verbose)
     128          std::cerr << "ERROR: found '" << copyrights[i] << "'\n"
     129                    << "expected: '" << copyright_correct[i] << "'\n";
     130      }
     131
    111132  }
     133
    112134
    113135  // Restoring file
Note: See TracChangeset for help on using the changeset viewer.