since tests for cmd.exe are a bit painful to write, please find attached a first version of them
the tests are in the .cmd file, and the expected output is in .cmd.exp
the hard part is to keep them in sync, hence the various lines starting with '---' which are synchronisation points
it looks I've been too optimistic with the multicriteria sort :-(
some additional testings show /O:NG doesn't take into account the G, but /O:GGGG-N does take into account the -N part...
(or /o:n-n sorts with N not -N, and /o:G-G-N doesn't take the -G into account but does take the -N into account!!!)
so the option regexp (not suggesting to use regexp in the patch, for clarification only) looks more (-?g)*(-?[nesd])*, and only the first one of g and [nesd] is used
so likely explains your remark about /O:GN vs /O:GNE
the idea is to have a first patch in the MR based on the attached file:
* tests shall pass on Windows * tests that fail on Wine shall be prefixed with @todo_wine@ * (feel free to adapt the attached patch to what you may find appropriate)
and a second patch in the MR that fixes the Wine code (and you have to remove the @todo_wine@ to mark the tests that now pass)
[diro.patch](/uploads/4bf00fbb81ddb692228f9d6ab61cee82/diro.patch)