docopt / docopt.nim

Command line arguments parser that will make you smile (port of docopt to Nim)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken with Nim devel, Windows

nigredo-tori opened this issue · comments

I get the following when running docopt tests (Win 7, Nim devel branch, docopt.nim master):

> nim c -r test.nim
Hint: used config file 'c:\dev\Nim\config\nim.cfg' [Conf]
-------- TEST NOT PASSED --------
Usage: prog [options]

--version
--verbose

"
$ prog --version
{"--version": true,
 "--verbose": false}
!= {--version: true, --verbose: nil}
---------------------------------
-------- TEST NOT PASSED --------
Usage: prog [options]

--version
--verbose

"
$ prog --verbose
{"--version": false,
 "--verbose": true}
DocoptExit on valid input
---------------------------------
-------- TEST NOT PASSED --------
Usage: prog [options]

--version
--verbose

"
$ prog --verb
{"--version": false,
 "--verbose": true}
DocoptExit on valid input
---------------------------------
Traceback (most recent call last)
test.nim(64)             test
test.nim(11)             test
docopt.nim(662)          docopt
docopt.nim(578)          docopt_exc
docopt.nim(436)          parse_pattern
docopt.nim(447)          parse_expr
docopt.nim(465)          parse_seq
docopt.nim(490)          parse_atom
docopt.nim(349)          move
system.nim(1427)         delete
system.nim(2544)         sysFatal
Error: unhandled exception: value out of range: -1 [RangeError]
Error: execution of an external program failed: 'c:\dev\tmp\docopt.nim\test\test.exe '

Everything works OK in Linux, though.

¯_(ツ)_/¯

I think that this is broken on linux as well, as I have similar failures on my machine.

Tests passed: 32/164
Error: execution of an external program failed: './test '

This is with running the latest devel version of the compiler as well, however

Nim Compiler Version 0.14.3 (2016-07-27) [Linux: amd64]
Copyright (c) 2006-2016 by Andreas Rumpf

git hash: 27a40cd5a43175d273bf15af0ce0c269ea76a49b
active boot switches: -d:release

I forked the repo and am looking into a fix, but I'm still getting up to speed with how all of this works.

Edit: Issue is due to changes in the strutils#split proc in stdlib, workaround by compiling with
nim c -d:nimOldSplit

@singularperturbation Your failures are not "similar" and have been fixed (judging by the number of tests it's the old issue)

I am still not really excited about debugging this on Windows.
Besides, if it's platform dependent and is a regression, it's not my fault, it's probably the language/implementation.

Sorry @BlaXpirit , I thought that this was a similar issue based on the description, but I can confirm that (my issue) was fixed by compiling with -d:nimOldSplit.

Thanks for your help :)

Why was this closed? I'm still getting the same errors with v0.6.3 and Nim v0.15.0 (devel too).

OK, the library couldn't handle CR LF newlines, which appear when Git for Windows checks out the file with such newlines, or when you use such newlines in your source code.