Skip to content

Commit

Permalink
Fix failure with Windows newlines
Browse files Browse the repository at this point in the history
Fixes #16
  • Loading branch information
oprypin committed Oct 2, 2016
1 parent a9d6b6f commit 20a4971
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/docopt.nim
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ proc extras(help: bool, version: string, options: seq[Pattern], doc: string) =

proc docopt_exc(doc: string, argv: seq[string], help: bool, version: string,
options_first = false): Table[string, Value] =
var doc = doc.replace("\r\l", "\l")

var argv = (if argv.is_nil: command_line_params() else: argv)

Expand Down
5 changes: 3 additions & 2 deletions test/test.nim
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ for each_line in (tests & "\n\n").split_lines():
doc = ""
line = line.substr(4)
if in_doc:
doc &= line & "\n"
doc &= line
if line.ends_with("\"\"\""):
doc = doc[0 .. doc.len-5]
doc = doc[0 .. doc.len-4]
in_doc = false
doc &= "\n"
elif line.starts_with("$ prog"):
assert args == nil and expected == nil
args = line.substr(7)
Expand Down

0 comments on commit 20a4971

Please sign in to comment.