Skip to content

Commit

Permalink
re #11569 file contents should be unix line endings and trimmed
Browse files Browse the repository at this point in the history
  • Loading branch information
NickDraper committed May 20, 2015
1 parent 5e75fae commit 524723c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Code/Mantid/Framework/Geometry/test/IDFObjectTest.h
Expand Up @@ -9,8 +9,11 @@
#include <Poco/DateTimeFormatter.h>
#include <Poco/Thread.h>
#include <Poco/SHA1Engine.h>
#include <Poco/String.h>
#include <Poco/DigestStream.h>

#include <boost/regex.hpp>

using Mantid::Geometry::IDFObject;
using Mantid::Kernel::ConfigService;

Expand Down Expand Up @@ -118,11 +121,20 @@ class IDFObjectTest : public CxxTest::TestSuite
filein.read(&contents[0], contents.size());
filein.close();

//convert to unix line endings
static boost::regex eol("\\R"); // \R is Perl syntax for matching any EOL sequence
contents = boost::regex_replace(contents, eol, "\n"); // converts all to LF

//and trim
contents = Poco::trim(contents);

SHA1Engine sha1;
DigestOutputStream outstr(sha1);
outstr << contents;
outstr.flush(); // to pass everything to the digest engine



auto head = path.getFileName();
auto tail = DigestEngine::digestToHex(sha1.digest());

Expand Down

0 comments on commit 524723c

Please sign in to comment.