Using perl 5.16 with the latest Test::More module.
I got a unit test being called like
is($ret, "ssh: connect to host 1.2.3.187 port 22: Network is unreachable\nCouldn't read packet: Connection reset by peer\n", "putFileWithSFTP bad server ret test");
Running the test fails with the following result:
# Failed test 'putFileWithSFTP bad server ret test'
# at t/Backup.t line 891.
# got: 'ssh: connect to host 1.2.3.187 port 22: Network is unreachable
# Couldn't read packet: Connection reset by peer
# '
# expected: 'ssh: connect to host 1.2.3.187 port 22: Network is unreachable
# Couldn't read packet: Connection reset by peer
# '
The strings should be equal and they also look like they are equal. What could be the cause of this?
CodePudding user response:
I figured it out:
When comparing the two strings with a hexdump, I noticed that, for whatever reason, the ssh ouput in $ret
contains MSWin Line Endings, which I didn't include in my comparison.
More can be read here