'Make sure line endings are translated correctly.
See https://github.com/qutebrowser/qutebrowser/issues/309'

def test_line_endings(self, tmpdir):

    filename = (tmpdir / 'foo')
    with qtutils.savefile_open(str(filename)) as f:
        f.write('foo\nbar\nbaz')
    data = filename.read_binary()
    if (os.name == 'nt'):
        assert (data == 'foo\r\nbar\r\nbaz')
    else:
        assert (data == 'foo\nbar\nbaz')
