Skip to content
This repository was archived by the owner on May 5, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions juliadoc/jldoctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ def report_failure(self, out, test, example, got):
Report that the given example failed.
"""
try:
out(self._failure_header(test, example) +
self._checker.output_difference(example, got, self.optionflags))
out(self._failure_header(test, example))
out(self._checker.output_difference(example, got, self.optionflags))
except:
raise Exception(example.want, got)

Expand Down Expand Up @@ -480,14 +480,14 @@ def __run(self, test, out):
self.julia.stdin.write('_ans=ans; nothing\n'.encode('utf-8'))
# read separator
sep = 'fjsdiij3oi123j42'
self.julia.stdin.write(('println("' + sep + '")\n').encode('utf-8'))
self.julia.stdin.write(('println("\\n' + sep + '")\n').encode('utf-8'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this become unnecessary if dump gets fixed / changed back? or is it harmless to have anyway?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we don't need this fix if dump gets fixed. I definitely still want to include this fix as it seems unreasonable for doctests to hang forever just because the output of a call doesn't have a trailing newline.

self.julia.stdin.flush()
got = []
line = ''
while line[:-1] != sep:
got.append(line)
line = self.julia.stdout.readline().decode('utf-8').rstrip() + '\n'
got = ''.join(got).expandtabs()
got = ''.join(got).expandtabs()[:-1]
exception = None
except KeyboardInterrupt:
raise
Expand Down Expand Up @@ -808,6 +808,15 @@ def test_group(self, group, filename):
j = Popen(["../julia"], stdin=PIPE, stdout=PIPE, stderr=STDOUT)
j.stdin.write("macro raw_str(s) s end;nothing\n".encode('utf-8'))
j.stdin.write("_ans = nothing\n".encode('utf-8'))
j.stdin.write("""
if VERSION >= v"0.5.0-dev+1911"
pushdisplay(TextDisplay(
IOContext(IOContext(STDOUT, :multiline => true), :limit => true)
));
nothing
end
""".encode('utf-8')
)
self.setup_runner.julia = j
self.test_runner.julia = j
self.cleanup_runner.julia = j
Expand Down