#2 test_comparative.exe failure

closed-fixed
nobody
None
5
2009-02-02
2008-05-05
Anonymous
No

Hi,

Just checking out the library now, it looks very interesting!

I get a test failure in test_comparative.exe as on Linux the filelist.txt is not parsed correctly due to windows line endings (\r\n), so none of the files can be opened. This is easily fixed in test_comparative/main.cpp by adding a mini functor:

bool is_pesky_newline(char c) { return c == '\r'; }

and changing the getline loop in main to:

while (getline(stream, name))
{
name.erase(remove_if(name.begin(), name.end(), is_pesky_newline), name.end());
if (!name.empty() && name[0] != ';')
files.push_back(name);
}

Cheers
Jon

linux.jon@gmail.com

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Similarly, in test_nodes/main.cpp,

    " \nfoo bar\t"
    comes out as
    " \r\nfoo bar\t" (length 12, not 11)
    and

    "el1 [\n\t<!ELEMENT el1 EMPTY>\n]"
    comes out as
    "el1 [\r\n\t<!ELEMENT el1 EMPTY>\r\n]"

    under Linux with windows encoded input. It might be an idea to mention that in the comment for parse_trim_whitespace.

     
  • mack

    mack - 2008-05-09

    Logged In: YES
    user_id=1274670
    Originator: NO

    Thanks for spotting that. On my dev machine I use Perforce, which automatically changes line endings when I checkout, so I never noticed this problem. Probably the easiest solution is to just have files with \n line endings, as they are recognized correctly by both Linux and Win, but I don't know about Macs?

     
  • mack

    mack - 2008-05-09
    • status: open --> open-accepted
     
  • Nobody/Anonymous

    This is fixed in 1.12

     
  • mack

    mack - 2009-02-02
    • status: open-accepted --> closed-fixed
     
  • mack

    mack - 2009-02-02

    Fixed in 1.12

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks