Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Preserve tab character while parsing XML (#829)
Browse files Browse the repository at this point in the history
* Preserve tab character while parsing XML

* Add test for tab character

* Remove tab from safe list so that it is quoted.

* Revert "Preserve tab character while parsing XML"

This reverts commit 9081654.
  • Loading branch information
karthiknadig authored Sep 21, 2018
1 parent c3217df commit 7b724f8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ def make_io_message(self, v, ctx):
v = v[0:MAX_IO_MSG_SIZE]
v += '...'

v = pydevd_xml.make_valid_xml_value(quote(v, '/>_= \t'))
v = pydevd_xml.make_valid_xml_value(quote(v, '/>_= '))
return NetCommand(str(CMD_WRITE_TO_CONSOLE), 0, '<xml><io s="%s" ctx="%s"/></xml>' % (v, ctx))
except:
return self.make_error_message(0, get_exception_traceback_str())
Expand Down
1 change: 1 addition & 0 deletions tests/resources/system_tests/test_misc/output_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print('Hello\tworld')
22 changes: 22 additions & 0 deletions tests/system_tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@ def test_with_no_output(self):
DebugInfo(filename=filename, cwd=cwd))


class OutputTests(LifecycleTestsBase):
def run_test_output(self, debug_info, expected_output):
options = {'debugOptions': ['RedirectOutput']}
with self.start_debugging(debug_info) as dbg:
session = dbg.session
lifecycle_handshake(session, debug_info.starttype,
options=options)
out = dbg.adapter._proc.output.decode('utf-8')
self.assertTrue(out.startswith(expected_output))
received = list(_strip_newline_output_events(session.received))
self.assert_contains(received, [
self.new_event('output', category='stdout', output=expected_output)
])

def test_tab_output(self):
filename = TEST_FILES.resolve('output_test.py')
cwd = os.path.dirname(filename)
self.run_test_output(
DebugInfo(filename=filename, cwd=cwd),
'Hello\tworld')


class ThreadCountTests(LifecycleTestsBase):
def run_test_threads(self, debug_info, bp_filename, bp_line, count):
breakpoints = [{
Expand Down

0 comments on commit 7b724f8

Please sign in to comment.