cruise-automation / rosbag.js

ROS bag file reader for JavaScript 👜

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"should read bytes from a file" test fails on Windows

gkjohnson opened this issue · comments

The test fails here on Windows because the reported size is 22 bytes rather than 21 bytes. I'm not exactly sure why but maybe it has something to do with line endings or an added byte at eof when reading?

One option is just to make sure that the reported size is the same as the size reported by the fs.stat:

assert.equal(reader.size(), fs.statSync(fixture).size);

Omg, classic windows. assert.equal(reader.size(), fs.statSync(fixture).size); seems reasonable to me.

Can't imagine that it would have to do with line endings, since the Reader is also using stat 😫

this._size = stat.size;

@jtbandes Yeah but on windows non-binary files are typically converted by git during clone/checkout to windows format which uses two bytes for line endings (cr-lf) instead of one on unix systems (lf). So it would make sense for stat.size to also report 22 bytes.

Heh, I was screaming on the inside, too.

assert.equal(reader.size(), fs.statSync(fixture).size); seems reasonable to me.

Great -- tacked this onto PR #30