test: fix cwd_and_chdir test on Unix

It was broken since for ever, but e8c4c329e69fff1b656c833883997ac663ea48ef added the assert which made it blow up on Unix.

R=@piscisaureus
I think this can be rephrased as:

```c
if (size1 > 0 && buffer_orig[size1 - 1] == '/')
  buffer_orig[size1 - 1] = '\0';
```

?

The `size1 > 0` check can probably be an ASSERT.